Jump to content

Date/Time - Timezone not being read.


Ninjakreborn

Recommended Posts

I am setting up a timestamp on a report for a client I built awhile back. I have quite a bit of experience messing with PHP dates, but never really had this issue. The timezone is set to GMT right now..I need it to default to EST and show EST time.

$date = date('l jS \of F Y h:i:s A');
$csv .= $date .', '; 
echo '<p>Time: '.$date.'</p>';

There, that shows the time. It was in GMT format..so I did some steps to try and change it.

I tried:

putenv("EST");

Afterwards I tried setting an INI file in the folder above it and set that to:

date.timezone = "EST"

It's still printing the time as...

Time: Tuesday 12th of January 2010 06:46:42 PM

When EST time would be my time (1:53 P.M.)

 

Edit: I am using, PHP Version 4.4.4.  That might be part of the issue...since I can't use that new function which allows you to set the default time.

 

Edit Part 2: Based off of my research,

date_default_timezone_set('EST');

would work if I had PHP 5. Unfortunately I don't.

Link to comment
https://forums.phpfreaks.com/topic/188237-datetime-timezone-not-being-read/
Share on other sites

you can do it like this to set your ini file:

http://beta.phpsnips.com/snippet.php?id=51

 

or if you have access to the ini file, just change it in there.

 

then, here is a list of timezones that you can use:

http://us.php.net/manual/en/timezones.php

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.