New answers tagged

4 votes

DrupalDateTime::createFromFormat() returns the wrong time value

I can see nothing unexpected. Midnight in UTC is 8 PM the day before in New York, at least in the summer time. Timestamps are always UTC. This is the reason why your second attempt $from = ...
user avatar
  • 88k
1 vote

DrupalDateTime::createFromFormat() returns the wrong time value

DrupalDateTime::createFromFormat() is basically a wrapper for PHP's createFromFormat. A search of the PHP docs reveals this comment: createFromFormat('U') has a strange behaviour: it ignores the ...
user avatar
1 vote

DrupalDateTime::createFromFormat() returns the wrong time value

I tried different snippets, but they all output a time for June 12, not for June 13. echo DrupalDateTime::createFromFormat('U', strtotime('last week monday'), new \DateTimeZone('America/New_York')) -...
user avatar
  • 94.1k
1 vote

How to use date_date_callbacks

Checking the official documentation of DateTime class, it appears that it calls all the function names passed as string in the #date_date_callback array (check processDatetime function). // Allows ...
user avatar

Top 50 recent answers are included