QDateTime::currentMSecsSinceEpoch ()
Dear all,
I would like your help concerning the current Date Time acquisition. I am trying to send a message from a client to a DB server. I am structuring the message as follows:
Code:
int random = qrand() & 10000;
I have no error but the final output of the date time isn't like 0000-00-00 00:00:00 as i expected, but it looks like this the message "256 J/N Di 15. Mai 17:41:39 2012".
Do you have any idea how to change it?
Thank you in advance!
Re: QDateTime::currentMSecsSinceEpoch ()
Why do you think it has to be 0000? QDateTime::currentDateTime returns you the current time.
P.S.
I think I understand. You mean the date format. If you want to have this result, regardless of the settings on your computer you must explicitly specify the format of toString.
Re: QDateTime::currentMSecsSinceEpoch ()
If you want the number of milliseconds since the epoch, as your thread title implies, then you should call QDateTime::currentMSecsSinceEpoch() to get a single massive number that has no format. If you want a portable string representation of the current time then I suggest you use:
Note that I have use UTC to allow for time zone and daylight savings differences between client and server.