Qt 6.11 is out! See what's new in the release
blog
[SOLVED] Help with converting old date to current date
General and Desktop
6
Posts
2
Posters
2.3k
Views
1
Watching
-
Hey everybody!
I have a set of numbers which represent the date and time in milliseconds. I'm converting them to human understandable form by using@
int time_in_msecs = 1350891180000;
QDateTime timestamp;
timestamp.setMSecsSinceEpoch(1350891180000);
qDebug() << timestamp.toString(Qt::SystemLocaleLongDate);
@I get the output as Monday, 22 October, 2012 1:03:00 PM . What I want to do is, each time I run my application, I want the date to be the current date. Time can remain the same.
So even if it is Monday, 22 October, 2012 1:03:00 PM , I want it to be converted to Tuesday, 29 January, 2013 1:03:00 PM
Any ideas on how I can do this? -
Hi Rochi!
I already tried what you suggested. Using _QDate_ or _QDateTime_ gives me the current date and the current time. What I want is to retain the _time_ which is there in _time-in-msecs_ while only changing its _date_ part.Thanks.
-
Yep. That worked so well. Thank you so much Rochi :)