Thanks feyd.
First of all I was wrong. EST is GMT - 0500.
Right now it's 11:20AM in FL (EST) and 16:20 in England. I know this for a fact, because my brother lives there.
Using your code.
Code: Select all
$str = 'l, Y F j, H:i:s';
$t = time();
echo gmdate($str, $t);
This code displays:
Tuesday, 2006 October 17, 15:20:51
So, it's one hour late. Is this a daytime saving time issue?
After reading your reply I settled on storing times in GMT, so it's important that I'll get the time right.
Also, running your second code:
Code: Select all
date($str, $t - date('Z'));
echo $date;
This code displayed:
Tuesday, 2006 October 17, 08:20:51 MST -0700 0
Again, that won't do, because that's the time in California and not in FL

Soooo, since my server is set wrong, I assume others' can be as well, which is no big deal. This is exactly why I have their preferred timezone saved in my db.
So I need a true GMT (not UTC) time -> $time_gmt.
The user's preferred timezone is stored in $user_timezone and has the value of EST, GMT, CET
I mostly deal with these three. CET = GMT +0100 and EST = GMT +0500
Before displaying any time I need a function that takes in $time_gmt and $user_timezone and gives me $time that is now calculated to the preferred time zone.
Any help would be great!