function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
bharath kumar 52bharath kumar 52 

How to display/change date time in records according to timezone?

Hi All,

I am working on a requirement where the cases are displayed in table in the following format

Casenumber, created date, last modified date,status, last modified by on a vf page.
I need to display the date according to the timezone of the user/agent who works on it. Currently the dates are displayed in GMT and i need to convert it to EST. 
How can i achieve this?

Thanks ,

Edgar MoranEdgar Moran
I used once fullCalendar for an implementation and I used this code to achieve to get the right datetime based on the time zone:
Datetime GMTDate = Datetime.newInstance(myDate.year(),myDate.year().month(), myDate.year().day(),0,0,0);
String strConvertedDate = GMTDate.format('MM/dd/yyyy HH:mm','America/Mexico_City');
Let me know if that works.