Skip to content

Tag: timezone

PHP UTC String to date

I have a problem. In my code I have the following line: The goal is to get the previous and next hour, so I tried this: But then the I get the following result: Because of my timezone (+1) the RunDateTimeGMT0 gets converted to a date of my timezone. I want the following result: How can I keep the date

Weird behavior PHP DateTime and DateTimeZone

PHP DateTime and DateTimeZone works incorrectly for me around DST change dates. I wrote a simple function to convert local time to UTC and I called it with the midnight time from the 24th of Oct to the 2nd of Nov with the timezones Europe/Paris and CET: The output: For Europe/Paris I got the changed DST inste…

PHP Time Conversion and Timezones

I’m trying to convert an RSS date (ISO 8601) to an iCalendar date. I thought I would turn the initial date time to a Unix timestamp, then format it with strftime. I understand that strftime changes a …

PHP convert UTC time to local time

Am getting a UTC time from my server like the following format, my requirement is to convert the UTC time to local time. So users can see a user friendly time on their browser based on their timezone. Please help me to solve this issue. Thank you I have tried some methods but not working in my case First Seco…