DateTimeZone::__construct(): Unknown or bad timezone (timezone)

fix a DateTimeZone error when saving dates in ChronoForms.

Overview

The error occurs because an invalid or unspecified timezone parameter is used in a CF date placeholder.
Replace the placeholder with a valid timezone identifier or use the site's default timezone setting.

Answered
ChronoForms v6
pe peppelaria 15 Jan, 2019
Hi Bob.
​
I'm having the following problem: "DateTimeZone::__construct(): Unknown or bad timezone (timezone)" on every db save action.
in the db save action I use "modified:{date/timezone:Y-m-d H:i:s}" to have the correct timezone saved in the db.
can you help me about this?
​
thanks in advance
he healyhatman 15 Jan, 2019
You need to replace "timezone" with an actual valid timezone.
he healyhatman 15 Jan, 2019
https://www.chronoengine.com/forums/posts/t106584/datetimezone-error

Also, you could leave it as {date:} and DISPLAY it as the correct timezone.
pe peppelaria 15 Jan, 2019
Answer
thanks Healyhatman, i solved creating a php variable
"putenv("TZ=Europe/Rome");
return date("Y-m-d H:i:s");"
and passing it to dbsave action: "nodified:{var:now}".
​
It's been too much work because I had to modify a great amount of forms
he healyhatman 15 Jan, 2019
Why? Just do it as
​
modified:{date/Europe/Rome:Y-m-d H:i:s}
​
OR if you just want it according to the server timezone set in your php.ini, use
​
modified:{date/site:}
This topic is locked and no more replies can be posted.