我在Mysql数据库中输入了日期时间字段。
例如,我用下一个Java代码存储支付日期:
payment.setCreatedOn(new Date(System.currentTimeMillis())); 在我的视图层中,我使用fmt:格式化格式化日期:
<fmt:formatDate value="${payment.createdOn}" pattern="EEE, dd MMM yyyy HH:mm:ss"/> 我的服务器在伦敦,我的应用程序的用户在维也纳。时间显示可能由于时区不同而延迟。我可以在fmt:formatDate中使用timeZone参数。
timeZone:用来表示格式化时间的时区。
在谷歌搜索后,我认为欧洲/维也纳的值对于timeZone参数是有效的。
是否有人知道是否存在有效timeZone字符串的列表?
发布于 2009-10-18 14:18:59
塞尔吉奥-我相信你早就找到它了.
这是奥尔森数据库主页或'zoneinfo‘,这是TZ信息的最终来源。
这是一个用于浏览区域的漂亮的维基。
发布于 2011-04-15 01:18:41
下面是IBM的列表,有点过时,但有完整的列表:
http://publib.boulder.ibm.com/infocenter/wsdoc400/v6r0/index.jsp?topic=/com.ibm.websphere.iseries.doc/info/ae/ae/adrtzval.htm
发布于 2014-05-08 08:00:32
您需要使用“国际时间”(UTC/Zulu)添加以下调度客户端时间使用,例如"GMT+1“。看这个例子。
将此参数作为参数放在服务器中以设置UTC时间使用,在本例中用于tomcat:
-Duser.timezone="UTC"
/* Java */
@RequestMapping(value = "/web", method = { RequestMethod.POST, RequestMethod.GET })
public String web(Model model, HttpSession session, Locale locale) {
Date today = new Date();
model.addAttribute("currentTime", today);
model.addAttribute("timezone", "GMT+1");
return "web";
}若要显示日期,请选择所需的模式(属性)
/* JSP web */
<fmt:timeZone value="${timezone}">
<spring:message code="date_format_dateMin" var="pattern"/>
<fmt:formatDate value="${currentTime}" timeZone="${timezone}" pattern="${pattern}" var="searchFormated" />
<span class="innerLabel">${searchFormated}</span>
</fmt:timeZone>
/* Properties */
date_format_dateMin=yyyy/MM/dd HH:mm
date_format=yyyy/MM/dd HH:mm:ss
date_format2=yyyy/MM/dd
date_format3_js=yy/mm/dd
date_format4_time=HH:mm
date_format4=dd/MM/yyyy HH:mm:sshttps://stackoverflow.com/questions/849038
复制相似问题