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.

  • Depends on the timezone of the queried user and the Organization timezone. Please mention them as well. – sfdcFanBoy Nov 6 '17 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) ' – Javier Vivaes Nov 7 '17 at 7:27
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>
| improve this answer | |

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.