0

Hi Im using this code on my page:

< apex:input type="datetime-local" styleClass="form-control" id="fechapesoinput" value="{!npesofechaPost}"  required="true"/>

The problem is that when I pick the time and I save it into a custom field Datetime, the time is one hour less than the hour I selected.

How can I change the GTM or adjust the hor properly.

At this moment im solving this ussue doing this at the back-end

m.Fecha__c =fechaRegistro.addHours(1);

but this is no solution as long as in my country we change de time every 6 months. This has to be automatic.

2
  • Depends on the timezone of the queried user and the Organization timezone. Please mention them as well.
    – sfdcFanBoy
    Nov 6, 2017 at 14:43
  • I checked my org profile and the timezone is well configured. ' Zona horaria predeterminada (GMT+01:00) Hora de Europa Central (Europe/Paris) ' Nov 7, 2017 at 7:27

1 Answer 1

0

I solved the problem doing this.

public Double offset{get{
        TimeZone tz = UserInfo.getTimeZone();
        //Milliseconds to Day
        return tz.getOffset(DateTime.now()) / (1000 * 3600 * 24.0);
    }} 

> <apex:outputText value="{0,date, dd-MM-yyyy HH:mm}"> <apex:param
> value="{!chats.CreatedDate+offset}"/></apex:outputText>

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .