date_default_timezone_set() function Vs. putenv(TZ=...)

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
plus200
Forum Newbie
Posts: 3
Joined: Sun Aug 02, 2009 12:46 pm

date_default_timezone_set() function Vs. putenv(TZ=...)

Post by plus200 »

Saw an old discussion about date_default_timezone_set() function Vs. putenv(TZ=...)

It was said there that date_default_timezone_set() is the better way to do that.

How is it better?
User avatar
jackpf
DevNet Resident
Posts: 2119
Joined: Sun Feb 15, 2009 7:22 pm
Location: Ipswich, UK

Re: date_default_timezone_set() function Vs. putenv(TZ=...)

Post by jackpf »

I'm not entirely sure...but why not use the function that's designed for setting the timezone to....set the timezone?

I imagine it could be faster.
plus200
Forum Newbie
Posts: 3
Joined: Sun Aug 02, 2009 12:46 pm

Re: date_default_timezone_set() function Vs. putenv(TZ=...)

Post by plus200 »

Well, I'm trying to do thing because I have a reason for "why yes" and not "why not" :wink:

People here were pretty decisive that date_default_timezone_set() is better, they just didn't say how.

Here is the original discussion:
viewtopic.php?f=1&t=100789
User avatar
jackpf
DevNet Resident
Posts: 2119
Joined: Sun Feb 15, 2009 7:22 pm
Location: Ipswich, UK

Re: date_default_timezone_set() function Vs. putenv(TZ=...)

Post by jackpf »

Yeah...I see what you mean :P

I think they recommend date_default_timezone_set() since it's the function specifically designed for setting the timezone, whereas putenv() is not.
plus200
Forum Newbie
Posts: 3
Joined: Sun Aug 02, 2009 12:46 pm

Re: date_default_timezone_set() function Vs. putenv(TZ=...)

Post by plus200 »

10x
Post Reply