我如何告诉DataMapper使用“带有时区的时间戳”?日期时间属性? [英] How do I tell DataMapper to use "timestamp with time zone" for DateTime properties?

查看:151
本文介绍了我如何告诉DataMapper使用“带有时区的时间戳”?日期时间属性?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

默认情况下,DataMapper在PostgreSQL中创建类型为 timestamp的DateTime属性,不带时区。我想将项目的默认值更改为带时区的时间戳记

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?

推荐答案

只需设置ENV ['TZ'] ='您的时区'

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

这篇关于我如何告诉DataMapper使用“带有时区的时间戳”?日期时间属性?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆