掲示板
Date
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
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
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.
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.
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
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.
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.
hi David
Came across this post when checking on getting dates to display right for user timezones.
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?
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?
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.
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.
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).