I have a date-field in my blueprint with time.
I create a page and i want to set the date to the current date and time. The result for me is that the time saved in the content-txt-file is two hours earlier than it actually is. 10:00 saves 8:00.
Anyone an idea of how to fix this?
'date' => date('Y-m-d H:i'),
(also tested with the default value of the date-field)
date:
label: Date
type: date
default: now
time: true
thanks!
Is your servers date/timezone properly configured? Im not sure where you are in the world but I think it defaults to GMT or UTC, which could be 2 hours behind where you are. You can add the following line to php.ini
to see if that helps (obviously amend it for where you are):
date.timezone = "US/Central"
To see what PHP thinks the current date and time is, you can do this in a template:
<?= (date("F d, Y h:i:s A", time() )) ?>
Be careful, you can have several php.ini on your system.
For instance on my Ubuntu Linux server:
/etc/php/7.2/cli/php.ini
/etc/php/7.2/fpm/php.ini
…