A
A
AleDv2016-04-19 20:28:54
Laravel
AleDv, 2016-04-19 20:28:54

Why is time incorrectly parsed from an SXML node?

Hello. There is an xml file in which each element has a child in which the time is written in RFC822 format (for example, Tue, 10 Apr 16 11:16:59 +0000).
I am trying to translate this date in this format:

$date = date('Y-m-d', strtotime($item->pubDate->__toString()));

As a result, I get the date 2016-04-12 instead of 2016-04-10.
Tell me why this is happening, where did I make a mistake?
PS Another example:
From Tue, 30 Apr 16 11:16:59 +0000 I get 2016-05-03.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
Vyacheslav Plisko, 2016-07-07
@AmdY

because the time zone is taken into account

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question