Display local 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
ngungo
Forum Commoner
Posts: 75
Joined: Thu Jun 08, 2006 10:45 pm

Display local time

Post by ngungo »

To display time I used:

Code: Select all

echo date('H:i ', time());
But that is GMT time. How do I display my local (Houston, TX, USA) time same as in my computer?
Thanls in advance.
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

ngungo
Forum Commoner
Posts: 75
Joined: Thu Jun 08, 2006 10:45 pm

Re: Display local time

Post by ngungo »

I got it, thanks!

Code: Select all

putenv(TZ="America/Chicago");
 echo date('H:i ', time());
Post Reply