Replace Date with ZonedDateTime

21 views
Skip to first unread message

Chris Malan

unread,
Aug 11, 2016, 11:22:48 PM8/11/16
to Grails Dev Discuss
All my clients are in specific time zones.  They are all deployed to Amazon Web Services.  The default there is UTC.  I can set the time zone to whatever I want to from the command line, but after certain updates, it's back to UTC.

I've done a quick test project using a ZonedDateTime.  It works well. MySQL assigns a tinyblob datatype to it.  My question, why not change dateCreated and lastUpdated to a ZonedDateTime and make the date selectors specify a ZonedDateTime.  In application.yml or application.groovy one can then specify a time zone.  It comes by default with UTC, in case one forgets to set it.  One can even have different users specify their own time zones.

This will make the time zone of the server irrelevant.  One's application will deploy to servers in different time zones and always show the same time zone.  It's very doable.

Hope this is the right forum for this.
Reply all
Reply to author
Forward
0 new messages