掲示板

Date

thumbnail
11年前 に Umer Sayeed によって更新されました。

Date

Junior Member 投稿: 51 参加年月日: 12/08/08 最新の投稿
Hi All ,

When i add new item in Shopping portlet, then in database CreateDate and ModifiedDate column date is comming correct but its taking 5hrs back time,suppose if a i add item at 6:00,in database its taking as 12:30.., please help how to solve this.

Thanks
thumbnail
11年前 に David H Nebinger によって更新されました。

RE: Date

Liferay Legend 投稿: 14919 参加年月日: 06/09/02 最新の投稿
There is nothing to resolve.

Liferay (as it should) stores dates/times in GMT mode. Users define the TZ they're in, and the GMT should be converted to the user's local time at presentation time.
thumbnail
11年前 に mohiden abdul kader によって更新されました。

RE: Date

Junior Member 投稿: 38 参加年月日: 12/08/08 最新の投稿
David H Nebinger:
There is nothing to resolve.

Liferay (as it should) stores dates/times in GMT mode. Users define the TZ they're in, and the GMT should be converted to the user's local time at presentation time.



Hi ,

I am also facing the same problem .Its not converting into local machine time,So Kindly give your valuable ideas..

Thanks Regards,
Abdul Kader
thumbnail
11年前 に David H Nebinger によって更新されました。

RE: Date

Liferay Legend 投稿: 14919 参加年月日: 06/09/02 最新の投稿
If you pull a date using SB, the date comes back to you as GMT.

From there you need to access the current user, find their selected TZ (it is directly accessible from the User pojo, getTimeZone()).

From there you'd define your DateFormat (for rendering), and set the timezone on the DateFormat to the user's TZ. When you call the format() method, it will give you a string with the date formatted for the user's timezone.

That's the hard way (all manual), but it works. An easier method would be:

DateFormat df = DateFormatFactoryUtil.getSimpleDateFormat("MM/dd/yyyy hh:mm", user.getTimeZone());

This will give you a date format w/ the timezone assigned that you can then use for rendering the date/time adjusted for each user.
thumbnail
10年前 に Dave Weitzel によって更新されました。

RE: Date

Regular Member 投稿: 208 参加年月日: 09/11/18 最新の投稿
hi David
Came across this post when checking on getting dates to display right for user timezones.
DateFormat df = DateFormatFactoryUtil.getSimpleDateFormat("MM/dd/yyyy hh:mm", user.getTimeZone());

is this still the preferred way of doing things?

I would have expected a tagLib to do this and detect if there is a user or not.

Our first multi timezone location is going live and so many dates are not showing right as everything is GMT!

Any new thoughts on this, does GA3 or 6.2 change things do you know?
thumbnail
11年前 に Hitoshi Ozawa によって更新されました。

RE: Date

Liferay Legend 投稿: 7942 参加年月日: 10/03/24 最新の投稿
If you're only going to be using in one time zone, just set user.timezone property in System-ext.properties.

I've seen some web systems do what liferay does on displaying time in user's timezone but this actually is very confusing because when there's an announcement that something is going to be on xxx date, it's difficult to know which timezone that means. If a timezone is given with the time, I still have to go check World Time page to see what time that is in my timezone.
thumbnail
11年前 に David H Nebinger によって更新されました。

RE: Date

Liferay Legend 投稿: 14919 参加年月日: 06/09/02 最新の投稿
We have users spread across the US. We display times in their timezone so they don't have to do the conversions in their heads or look at the world clock. We store our times in GMT so it's an easy one-way conversion. Using a non-GMT timezone, we'd have to convert between two different timezones, and that can get kinda messy (especially w/ DST stuff thrown in).
thumbnail
11年前 に Hitoshi Ozawa によって更新されました。

RE: Date

Liferay Legend 投稿: 7942 参加年月日: 10/03/24 最新の投稿
Yes, this is really a localization problem. Some of us only use 1 timezone and it's really confuses users. I think India is in 1 timezone too.
thumbnail
11年前 に Umer Sayeed によって更新されました。

RE: Date

Junior Member 投稿: 51 参加年月日: 12/08/08 最新の投稿
hi i found the solution, just write ASIA/KOLKATA in place of GMT in setenv.bat in tomcat server....,


Thanks and Regards,
Ummer