Foren
convert from GMT to other usa Timezone
Akash Jaisawal, geändert vor 7 Jahren.
convert from GMT to other usa Timezone
Regular Member Beiträge: 141 Beitrittsdatum: 03.03.12 Neueste Beiträge
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, geändert vor 7 Jahren.
RE: convert from GMT to other usa Timezone
Liferay Legend Beiträge: 14919 Beitrittsdatum: 02.09.06 Neueste Beiträge
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, geändert vor 7 Jahren.
RE: convert from GMT to other usa Timezone
Liferay Master Beiträge: 679 Beitrittsdatum: 17.04.09 Neueste Beiträge
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, geändert vor 7 Jahren.
RE: convert from GMT to other usa Timezone
Liferay Legend Beiträge: 14919 Beitrittsdatum: 02.09.06 Neueste BeiträgeSagar 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.