留言板
convert from GMT to other usa Timezone
Akash Jaisawal,修改在7 年前。
convert from GMT to other usa Timezone
Regular Member 帖子: 141 加入日期: 12-3-3 最近的帖子
Hi All,
I have a time field where we are fetching the time from DB which is in GMT which i want to convert into Other US user based time zones.
any help?
Regards
Akash K Jaiswal
I have a time field where we are fetching the time from DB which is in GMT which i want to convert into Other US user based time zones.
any help?
Regards
Akash K Jaiswal
David H Nebinger,修改在7 年前。
RE: convert from GMT to other usa Timezone
Liferay Legend 帖子: 14919 加入日期: 06-9-2 最近的帖子
The User interface has getTimeZone() which returns the time zone for the user. Combine that w/ a call to com.liferay.portal.kernel.util.DateUtil and you can build a string suitable for display in best format for the user.
Sagar A Vyas,修改在7 年前。
RE: convert from GMT to other usa Timezone
Liferay Master 帖子: 679 加入日期: 09-4-17 最近的帖子
Hi Akash,
You can use jsp taglib too , if you set your date object into req. attribute and use following taglib to display them directly, you can also define other attribute in it too like dateformat and timeZone etc..
Thanks,
Sagar Vyas
You can use jsp taglib too , if you set your date object into req. attribute and use following taglib to display them directly, you can also define other attribute in it too like dateformat and timeZone etc..
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<fmt:formatdate timeZone="${timeZone}" pattern="yyyy-MM-dd" value="${myDate}" />
Thanks,
Sagar Vyas
David H Nebinger,修改在7 年前。
RE: convert from GMT to other usa Timezone
Liferay Legend 帖子: 14919 加入日期: 06-9-2 最近的帖子Sagar A Vyas:
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %> <fmt:formatdate timeZone="${timeZone}" pattern="yyyy-MM-dd" value="${myDate}" />
This format does not take the user's localization standards into account.