2

PHP's strtotime("2015-05-11 00:03:24 UTC+1") gives me the unix timestamp 1431302604. But the timestamp should be 1431299004.

Am I wrong? Or how can I correctly parse this date with PHP 5.4.

2
  • According to php.net/manual/en/function.strtotime.php strtotime give a Unix timestamp with default timezone if not specified in input. PHP versions >5 dont change that fact Commented Aug 14, 2015 at 22:21
  • Isn't the TZ specified in the input? I think UTC+1 is the timezone. But strtotime() doesn't honor this. That's my problem. Commented Aug 14, 2015 at 22:25

1 Answer 1

3

Try strtotime("2015-05-11 00:03:24+01:00")

Sign up to request clarification or add additional context in comments.

2 Comments

Thanks. This gives the correct result. Great! (But I am getting the date strings from an external API. I would need to do some ugly string replacement. I tried to use DateTime::createFromFormat() with no success so far.)
Well you can remove the UTC and just have strtotime("2015-05-11 00:03:24 +1")

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.