Skip to main content
I want to show the Start Date and End Date in user's Local time Zone. For this I have created a Visual Force Page and through getter and setter method, when I am showing IN VF Page,I am getting the time in GMT. What is the way for the the logged-in user to show the local time in Visual force Page?

 
3 answers
  1. May 6, 2016, 9:34 PM
    Hello There,

     

    Try this:

    String timeZone = UserInfo.getTimeZone().getID();

    Datetime dateGMT=System.now();// here you can user your dates e.g. createddate

    Datetime d1=Datetime.valueOf(dateGMT);

    string s1=d1.format();

    System.debug('@@@@@@@@@@@'+s1);

    Note: Please mark it as solved if that helps.

     
0/9000