Quantcast
Channel: Issues for Drupal core
Viewing all articles
Browse latest Browse all 291170

Unify format_date() and DrupalDateTime::format()

$
0
0

Problem:

I have a DateTime or DrupalDateTime object already. I want to format it using format_date(). This means I have to convert it to a timestamp, and then format_date() converts it back into a *new* DrupalDateTime object again. This seems unnecessary. It would be nice if format_date() could accept a DrupalDateTime object, or better yet, if DrupalDateTime::format() contained the logic for timezone fallback and other code from format_date, so that I if have an object, I can just call $date->format('medium') and get the same output as format_date($date->getTimestamp(), 'medium');


Viewing all articles
Browse latest Browse all 291170

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>