Database Record Created_at Time Randomly Changes
I'm using a server with Debian, PHP7, PHP-FPM and APCu.
I have NTP installed and server time set to UTC.
/etc/php/7.0/fpm/php.ini I have set
date.timezone = "UTC".
I have a gallery where you can upload a file.
It saves a record to the database and sets the time uploaded to the
date_default_timezone_set('UTC'); $date = date("Y-m-d h:i:s", time()); # Save Database Record $image = new Gallery(); $image->title = $title; $image->created_at = $date; $image->save();
The gallery is arranged by latest image first, using
Several times now after uploading, the time on the record has been set many hours back.
This makes the gallery images display all out of order.
OctoberCMS database viewer:
When I run
date in the terminal, it returns
15:39:24, 3:39 PM.
What could be causing the time to change? And why 3 different conflicting times?
You have a typo in the date format. It should be
Y-m-d H:i:s instead of
h is for 12-hour format of an hour with leading zeros
and the capital
H is for 24-hour format of an hour with leading zeros
- → "failed to open stream" error when executing "migrate:make"
- → October CMS Plugin Routes.php not registering
- → OctoberCMS Migrate Table
- → OctoberCMS Rain User plugin not working or redirecting
- → October CMS Custom Mail Layout
- → October CMS - How to correctly route
- → October CMS create a multi select Form field
- → October CMS - Conditionally Load a Different Page
- → How to disable assets combining on development in OctoberCMS
- → October CMS - Radio Button Ajax Click Twice in a Row Causes Content to disappear
- → OctoberCms component: How to display all ID(items) instead of sorting only one ID?
- → In OctoberCMS how do you find the hint path?
- → How to register middlewares in OctoberCMS plugin?