Page 1 of 1

converting time

Posted: Mon Aug 13, 2007 10:08 pm
by scout3014
Hi all

i am trying out to type out the local time here but i canot just use time() as it onli gives a timestamp. I am totally lost as how to convert the time to the local time here. And i want to display it as datetime format. The timezone i need is GMT +8

Thanks

Posted: Mon Aug 13, 2007 11:07 pm
by SidewinderX
There must be a million ways to do this:

time() is in seconds, so to add 8 hours - convert 8 hours to seconds a la

Code: Select all

$time = time() + (60 * 60 * ;
If you want it in datetime format you can use the date() function [even has format characters for timezones (may be of a help) ]

Never used it before, but there is even a localtime() function

date difference

Posted: Tue Aug 14, 2007 8:28 pm
by scout3014
thks, i got another problem here.

I need to make calculate the date difference between 2 dates and the format of those 2 dates are YYYY-MM-DD, on a side note how so u calculate if there is a leap year and thus how do u know if 29 feb is a valid date.

Regards

Posted: Tue Aug 14, 2007 8:55 pm
by angelena