Loading

Add or subtract hours from a Date/Time field

Udgivelsesdato: Oct 13, 2022
Beskrivelse

The syntax you can use to add/subtract hours from a Date/Time field is detailed below.

Løsning


Add N hours to a date/time field: Datetimefield__c + (N/24)
Subtract N hours to a date/time field: Datetimefield__c - (N/24)

You can use these functions in a formula when converting a GMT value to another timezone. You can add or subtract the hours depending on the offset. 

Notes:

  • In these instructions, N is the number of hours.
  • Date/Time fields are always calculated using GMT timezone and any calculation would need to take the timezone difference into account. 
  • Please take into consideration that daylight savings time cannot be calculated into this formula without use of Apex. Please see the article for more details on How to use Date, Date/Time & Time Values in Formulas. 

 

Vidensartikelnummer

000384478

 
Indlæser
Salesforce Help | Article