PDA

View Full Version : How to get seconds diferences between two datetime



gustavedgardo
4th March 2009, 18:39
Hello, i want to get the difference between two datetimes values,
are there any function in datetime class?

example:
QDateTime firstDateTime;
QDateTime lastDateTime;

int seconds=int.Parse(lastDateTime - firstDateTime);

Thanks.
Regards.

boudie
4th March 2009, 22:05
Try this:

QDateTime firstDateTime;
QDateTime lastDateTime;
int seconds = lastDateTime.toTime_t() - firstDateTime.toTime_t();