bildwelt
E2E FORUM
E2E Bridge E2E Commerce

How to check if a date is a DST day

E2E Forum Modeling & Development How to check if a date is a DST day

This topic contains 1 reply, has 2 voices, and was last updated by  Alfred 2 years, 9 months ago.

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #1813

    Martin Hald
    Participant

    Hi

    We need to verify if a day date (e.g. 26.10.2014) is a DST day. The DST day is always the last sunday in october (e.g. for last year 26.10.2014) or march (30.03.2014).

    Can you please let me know how this can be implemented in the bridge?

    Thanks.

    Regards
    Martin

    #1814

    Alfred
    Moderator

    You need to write a little helper function.

    In the helper function you need to query the timezone offset for a specific date. The timezone offset includes the DST offset and so you can check if the timezone offset changes for a date.
    The daylight saving changes between two and three o’clock so you need to
    query one time before (0) and one time after (4) the DST switch.

    The format %z of printDateTimeExpression returns the timezone offset as +hhmm or -hhmm.

    local dateTime_no_DST = convertToDateTime('2014-10-26T04:00:00+01:00');
    local offset_no_DST = printDateTimeExpression(dateTime_no_DST, '%z', 'CET');
    local dateTime_DST = convertToDateTime('2014-10-26T00:00:00+01:00');
    local offset_DST = printDateTimeExpression(dateTime_DST, '%z', 'CET');
    

    The value of offset_no_DST is for European timezone CET +0100.
    The value of offset_DST is for European timezone CET +0200.

    For another date which is not a DST day both offset would be the same.

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.