parent root
PHP: Date/Time - Manual
PHP 7.2.23 Release Announcement

Date and Time

add a noteadd a note

User Contributed Notes 1 note

up
15
Moo0z0r
9 years ago
I think it's important to mention with the DateTime class that if you're trying to create a system that should store UNIX timestamps in UTC/GMT, and then convert them to a desired custom time-zone when they need to be displayed, using the following code is a good idea:

<?php
date_default_timezone_set
('UTC');
?>

Even if you use something like:

<?php
$date
->setTimezone( new DateTimeZone('UTC') );
?>

... before you store the value, it doesn't seem to work because PHP is already trying to convert it to the default timezone.
To Top
parent root