Replies: 3 comments
-
You can configure database timezone in the https://cycle-orm.dev/docs/basic-connect#additional-connection-options Will this solve your issue? |
Beta Was this translation helpful? Give feedback.
-
Thanks, this solved the issue in my case . The documentation at second url is a bit confusing because it says:
But it solved the issue only because the application will be used by users in same time zone. |
Beta Was this translation helpful? Give feedback.
-
In this case you should:
|
Beta Was this translation helpful? Give feedback.
-
How to reproduce
date
Expected result
2000-05-05
Actual result
2000-05-04
This happens because 2000-05-05 is represented as 2000-05-05 00:00:00.000000 in
DateTimeImmutable
.When persisting in DB it's converted from UTC+2 to UTC which is 2000-05-04 22:00:00.000000. Then it is stored in
DATE
type column as 2000-05-04.When loading from DB the date is loaded as 2000-05-04 00:00:00.000000 and converted into UTC+2 as 2000-05-04 02:00:00.000000.
Conclusion
The columns with type
date
should not be subject to automatic timezone conversion because timezone conversion only makes sense when the date includes time.Beta Was this translation helpful? Give feedback.
All reactions