Last active
August 28, 2024 07:00
-
-
Save rang501/bc08b936ff62fc6096cea6a77002cec6 to your computer and use it in GitHub Desktop.
Get correct time from datetime field (D8)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$date = DrupalDateTime::createFromFormat(DATETIME_DATETIME_STORAGE_FORMAT, 'datetime string', DATETIME_STORAGE_TIMEZONE); | |
$date->setTimeZone(new DateTimeZone(drupal_get_user_timezone())); | |
$date->format('d.m.Y H:i'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment