bildwelt
E2E FORUM
E2E Bridge E2E Commerce

How can I parse the correct date of datetime string

E2E Forum Modeling & Development How can I parse the correct date of datetime string

This topic contains 0 replies, has 1 voice, and was last updated by  Jürgen 4 years ago.

Viewing 1 post (of 1 total)
  • Author
    Posts
  • #731

    Jürgen
    Moderator

    How can I parse the correct date of datetime string having no timezone, but being of local time?

    It is important that you find out the time zone offset of the date string you want to convert. The summer and winter time is considered. I have attached a small example model, where you can trace each single step.
    // What timzone offset has the localDateTime?
    set tempDateTime = localDateTime.parseDateTimeExpression(“%Y-%m-%dT%H:%M:%S”);
    set localDateTimeWithTimezone = concat( localDateTime, tempDateTime.printLocalDateTimeExpression(” %z”));
    // Parse it again but now with timezone offset.
    set result = localDateTimeWithTimezone.parseDateTimeExpression(“%Y-%m-%dT%H:%M:%S %z”);
    The result datetime is in UTC (always), but now having the correct time (was initially local in the string).

Viewing 1 post (of 1 total)

You must be logged in to reply to this topic.