How do I tell DataMapper to use “timestamp with time zone” for DateTime properties?

我是研究僧i 提交于 2019-12-22 11:19:59

问题


By default, DataMapper creates DateTime properties of type timestamp without time zone in PostgreSQL. I'd like to change that default for my project to timestamp with time zone. How can this be done?


回答1:


Just set ENV['TZ'] = 'your timezone'




回答2:


just in case some jruby users pass by:

you need to set ENV['TZ'] = 'your timezone' and

org.joda.time.DateTimeZone.setDefault(org.joda.time.DateTimeZone.forID('your timezone'))

'UTC' works fine for me. for other timezone you might need to dig into joda-time.



来源:https://stackoverflow.com/questions/5876563/how-do-i-tell-datamapper-to-use-timestamp-with-time-zone-for-datetime-properti

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!