PDA

View Full Version : Date Time



starcontrol
4th April 2008, 10:45
Hi,
I have to calculate how many day are between two date events, for example:
How many dates are from Jan/2008 to Jul/2009.
Is there any help from Qt ?
Do you know how I have to implement ?

Thanks
Alex

starcontrol
4th April 2008, 10:57
ups, sorry, ok, there is a function called "daysTo()" from QDate, I think it will help me...

McToo
4th April 2008, 11:01
How about:

QDate date1 = QDate::fromString( "Jan 2008", "MMM yyyy");
QDate date2 = QDate::fromString( "Jul 2009", "MMM yyyy");

int numberOfDays = date1.daysTo( date2 );

The above gives the number of days between those two dates.

HTH
McToo

McToo
4th April 2008, 11:02
:D Beat me to it!