Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
[SOLVED] Help with converting old date to current date
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;
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?
@qDebug() << timestamp.toString(QDateTime::currentDateTime().toString());@
Note: if you want to change only the date, then use
Thanks & Regards
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.
then please try this.
qDebug() << timestamp.toString(Qt::SystemLocaleLongDate);@
Yep. That worked so well. Thank you so much Rochi :)