Reputation: 1892
i have a table with several timezones but just saved as string like "UTC+1" or "UTC-6" etc
how do i put that through the DateTime function to get what the time would be now in that zone
is it even possible?
am i close with this?:
$localtime = new DateTime("now", "UTC+6");
thanks
Upvotes: 0
Views: 1994
Reputation: 244
I've never tried this trick, but looks like this question is already been asked and answered:
php: setting a timezone by UTC offset
Upvotes: 1
Reputation: 1356
You should use date_default_timezone_set
like so:
date_default_timezone_set(UTC+6 TIMZONE HERE);
Upvotes: 0