如何在用户的GMT语言环境中显示网站上的所有日期时间?

I store all datetime values as unix timestamp. Registered users can set personal GMT locale in their profile. What should I do to display all datetime on website in user's GMT locale?

Thank you

There's no such thing as "user's GMT locale". You must be referring to the user's timezone.

You can convert unix timestamps to dates in the user timezone this way:

$timestamp = ...;
$tz = new DateTimezone("Europe/Lisbon"); //substitute by the user's timezone
$d = new DateTime("@$timestamp");
$d->setTimezone($d);
echo $d->format(DateTime::RFC822);

If you only have a GMT offset, you can use:

$tz = new DateTimezone("Etc/GMT-12");

Note, however, that if you use GMT offsets, you will have to change them when the users enter or leave daylight saving time.

With PHP:

date("Y-m-d H:i:s", $timestamp);

With MySQL:

FROM_UNIXTIME()