View Single Post
  #10 (permalink)  
Old 07-19-2008, 01:00 PM
Michael Fesser
 
Posts: n/a
Diggs:
Default Re: Date formatting according to UTC timezones

.oO(Gary White)

>On Fri, 18 Jul 2008 22:04:55 +0000 (UTC), "RichardODreamweaver"
><webforumsuser@macromedia.com> wrote:
>
>> Gary - as my server does support it, I'm not sure why I need the if function
>>exists code?

>
>It's just a safeguard. If the date_default_timezone_set() function is
>supported, it is executed. On the other hand, if you later change
>hosts and wind up with a server that does not support it, it won't
>generate an error and fail.


I don't think that this is very likely. Every good host should at least
support 5.1. Changing to another host should not become a "downgrade".

Anyway, another possible solution might be something like this:

if (!function_exists('date_default_timezone_set')) {
function date_default_timezone_set($z) {
putenv("TZ=$z");
}
}

I use a similar thing in my own scripts for the function str_getcsv().
It is already in the CVS, but not yet available in the stable releases.
But since I already want to use it, I simply use my own implementation
in a code block like above until the official version becomes available.

Micha
Reply With Quote