掲示板

convert from GMT to other usa Timezone

thumbnail
7年前 に Akash Jaisawal によって更新されました。

convert from GMT to other usa Timezone

Regular Member 投稿: 141 参加年月日: 12/03/03 最新の投稿
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
thumbnail
7年前 に David H Nebinger によって更新されました。

RE: convert from GMT to other usa Timezone

Liferay Legend 投稿: 14914 参加年月日: 06/09/02 最新の投稿
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.
thumbnail
7年前 に Sagar A Vyas によって更新されました。

RE: convert from GMT to other usa Timezone

Liferay Master 投稿: 679 参加年月日: 09/04/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..


<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<fmt:formatdate timeZone="${timeZone}" pattern="yyyy-MM-dd" value="${myDate}" />


Thanks,
Sagar Vyas
thumbnail
7年前 に David H Nebinger によって更新されました。

RE: convert from GMT to other usa Timezone

Liferay Legend 投稿: 14914 参加年月日: 06/09/02 最新の投稿
Sagar A Vyas:

&lt;%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %&gt;
<fmt:formatdate timeZone="${timeZone}" pattern="yyyy-MM-dd" value="${myDate}" />


This format does not take the user's localization standards into account.