Skip to Content

Daylight Savings formula syntax

Hi, I'm working on a formula that will add or subtract minutes based on the daylight savings time. The formula is defined correctly.

However, when I add it to the report I get an "Error"

=If ((CurrentDate()>=ToDate("03-08";"MM-DD"))And (CurrentDate()<=ToDate("11-01";"MM-DD"));[Age of Incident (minutes)]+240;[Age of Incident (minutes)]+300)

Add comment
10|10000 characters needed characters exceeded

  • Follow
  • Get RSS Feed

1 Answer

  • Oct 07, 2015 at 08:51 PM

    Hi,

    use this.

    =If ((CurrentDate()>=ToDate("03-08";"MM-dd"))And (CurrentDate()<=ToDate("11-01";"MM-dd"));[Age of Incident (minutes)]+240;[Age of Incident (minutes)]+300)


    Amit

    Add comment
    10|10000 characters needed characters exceeded

    • Hi Amit,

      After breaking out each formula element realized that the CurrentDate needed to be formatted the same way as DST.

      This is what I came up with. I broke it out into 4 formulas for ease of troubleshooting:

      Format current date:

      =FormatDate(CurrentDate();"MM-dd")

      format start of DST:

      =FormatDate(ToDate("03-08";"MM-dd"); "MM-dd")

      End of DST:

      =FormatDate(ToDate("11-01";"MM-dd"); "MM-dd")

      Formula:

      = If (([1 - CurrentDate]>=[2 - Start of DST] And [1 - CurrentDate]<=[3 - End of DST]);1;2)

      It appears to be working this way.

      Thank you so much for your help. I really appreciate.