我有一个grails项目
Customer customer = Customer.get(params.id)
其中 customer 是域类
我需要显示
Date date = customer.createDate
在用户本地设置
我可以使用 java 或 grails 或 groovy 或 html 或 javascript 来做到这一点
示例:
if date = "2012-01-01 00:00:00.0" in GMT
then user must display it as "2012-01-01 01:00:00.0" in London (GMT +1)
对使用用户本地设置显示日期有什么帮助吗?
最佳答案
显示此站点 http://www.pageloom.com/automatic-timezone-detection-with-javascript很有帮助
下载 jstz.min.js 并向您的 html 页面添加一个函数
<script language="javascript">
function getTimezoneName() {
timezone = jstz.determine_timezone()
return timezone.name();
}
</script>
并将这个函数称为你的标签
关于java - Java下使用用户本地设置显示日期,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8755354/