开发者

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

开发者 https://www.devze.com 2023-03-02 08:30 出处:网络
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

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?


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


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消