What version of PHP, and what OS?  As far as I am concerned, dealing
with timezones on PHP4 and Windows is just too much trouble - the
timezones need to be in a windows specific format ( 
http://bugs.php.net/bug.php?id=22418
) rather than the common TZ format.

If you have PHP5, just use date_default_timezone_set and
date_default_timezone_get.  If you have PHP4, try these in your app/
config/bootstrap.php:

if ( !function_exists('date_default_timezone_get') ){
        // PHP < 5.1
        function date_default_timezone_get()
        {
                $env_tz = env("TZ");
                if ( !empty($env_tz) ){
                        return $env_tz;
                }

                return false;
        }
}

if ( !function_exists('date_default_timezone_set') ){
        // PHP < 5.1
        function date_default_timezone_set( $zone )
        {
                // standard timezone format only actually works on linux, not
windows
                if ( strpos(strtolower(env('OS')), 'win') !== false ){
                        // running on windows
                        return false;
                }
                putenv ('TZ='.$zone );
        }
}



On Mar 27, 2:57 am, "squidliberty" <[EMAIL PROTECTED]> wrote:
> I live in the south-eastern US and I'm storing timestamps in my
> database. I need date() to reflect my time zone when viewing this
> data. Without access to php.ini, how can I do this for CakePHP?
>
> Ive tried adding putenv("TZ = America/New_York"); and
> ini_set("date.timezone","America/New_York"); in core.php but neither
> seemed to change my results.
>
> Thanks!


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to