How can I convert the time zone of a date string in php without changing the default time zone. I want to convert it locally to display only. The php time zone settting should not be modified.
EDIT:
My source time is a UTC string, I want to convert it to a different format, retaining the time zone as UTC, but php is converting it to local timezone.
The code I used was:
date('Y-m-d H:i::s',strtotime($time_str));
How do I retain timezone?
Note that if the source time is UTC, you can change the one line to this:
Edit: Looks like you want to go to UTC. In that case, just use
"UTC"as the parameter to the$dest_tzconstructor, and use the original block of code. (And of course, you can omit the$src_tzparameter if it is the same as the default time zone.)