I need to capture the current users current time in a VF page. Is there a way to capture that info in controller?
Attribution to: Prady
Possible Suggestion/Solution #1
System.Now should give you the Current time and display to the User in his local current time Zone .
Other approach is to get the locale using userinfo.getlocale
1)Maintain an offset in custom setting
2)From GMT time you can set the Offset.
I would say that simply system.Now gets you time in the Time Zone of the User
Attribution to: Mohith Shrivastava
Possible Suggestion/Solution #2
Spring '13 will have a TimeZone class. You'll be able to get the timezone for the current user and do whatever math you need based on its offset from GMT.
Attribution to: Josh Kaplan
Possible Suggestion/Solution #3
If you don't mind having the date in there:
System.now().format()
Attribution to: Phil Rymek
This content is remixed from stackoverflow or stackexchange. Please visit https://salesforce.stackexchange.com/questions/4907