php - Database Record created_at Time Randomly Changes -


i'm using octobercms based on laravel.

i'm using server debian, php7, php-fpm , apcu.

i have ntp installed , server time set utc.

in /etc/php/7.0/fpm/php.ini have set date.timezone = "utc".


i have gallery can upload file.

it saves record database , sets time uploaded created_at column.

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 arranged latest image first, using created_at date/time.

several times after uploading, time on record has been set many hours back.

this makes gallery images display out of order.

octobercms database viewer:

database created_at time


when run date in terminal, returns 15:39:24, 3:39 pm.

what causing time change? , why 3 different conflicting times?

you have typo in date format. should y-m-d h:i:s instead of y-m-d h:i:s

the small h 12-hour format of hour leading zeros , capital h 24-hour format of hour leading zeros


Comments

Popular posts from this blog

inversion of control - Autofac named registration constructor injection -

verilog - Systemverilog dynamic casting issues -

ios - Change Storyboard View using Seague -