+ Start a Discussion
ChichoChicho 

Date/Time field - Local and GMT

I have a custom date/time field in the Lead object. Let's say user enters 7/8/2013 6pm CST but the value is storage in the database in GMT = 7/8/2013 11pm GMT. (Salesforce storage all date/time values in GMT time by default).

 

I created a HTML table in Visualforce with a custom controller that pull date/time values from the Lead object and display them in GMT (7/8/2013 11pm GMT) while in the detail page of the Lead object date/time values are showed in the time the user entered it (7/8/2013 6pm CST).

 

How can I display the date/time values in the Visualforce page as they are showed in the detail page of the Lead object, that is, 7/8/2013 6pm CST instead of GMT?

 

Thank you!

ChichoChicho

I've just changed the outputText component that brings the value to the UI for the outputField component and it works, it displays the locale time. What I'm not sure if it's safe to use it when rendering the page as PDF...

hisalesforcehisalesforce

Visualforce and pdf are same .There is no difference .If its working on visual force it will work on pdf.

But test your code for different time zone.For eg:If you want to display timezone to specific user or org timezone.