1

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!

1

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...

  • Using renderas doesn't affect the logic layer, only the rendering engine, so you'll still get the same output. FYI, Visualforce rendered as PDF just generates the same HTML markup then passes the HTML to Flying Saucer, a Java PDF library. – sfdcfox Jul 12 '13 at 14:04
0

You can use DateTime format() method which will return formatted string using the locale of the context user.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.