converting time

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
scout3014
Forum Newbie
Posts: 4
Joined: Wed Jul 25, 2007 3:51 am

converting time

Post 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
SidewinderX
Forum Contributor
Posts: 407
Joined: Fri Jul 16, 2004 9:04 pm
Location: NY

Post 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
scout3014
Forum Newbie
Posts: 4
Joined: Wed Jul 25, 2007 3:51 am

date difference

Post 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
angelena
Forum Commoner
Posts: 53
Joined: Mon Nov 22, 2004 4:10 am

Post by angelena »

Post Reply