well I am using this code to format my date and time:

$date = date("m/d/Y g:i:s A T");
echo $date;

and it prints out:

08/10/2006 4:07:37 AM GMT

The problem is that it is printing the time in GMT which is wrong as I want it to tell me the time in EST or what ever it is set on viewer's machine.
Thanks

Recommended Answers

All 5 Replies

I got it I had to use this code to change the timezone diffrence:

$timezone  = -5; //(GMT -5:00) EST (U.S. & Canada)
$date = date("m/d/Y g:i:s A", time() + 3600*$timezone);
echo $date;

But I still have the problme of getting to program to figure out if it is daylight saving time or not.

Does it matter? Some servers adjust their clocks automatically for daylight savings time and your timezone settings figure it out automatically.

well it kind of matters as who ever sees this info will have to know that if it was daytime saving or not when they view it but at this time I can go without it unless they say it is must.
I dont even know why there is daytime saving.

Daylight savings time is a stupid human trick. During crop growing time, i.e. summer in the US, the "extra hour" gives farmers "more time" to work in the daylight.

In reality, there's still the same number of hours in a day except twice a year where it's 23 and 25 hours. I'll have to wish a friend of mine happy birthday when daylight savings time ends. (Her birthday fell on the beginning of DST so it was only 23 hours.)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.