1
0
-1

Hi all,

is there a simple way to convert UTC format like, for example,  "2019-06-06T08:58:42.1878669Z" to a local time zone considering also daylight period ?


Many thanks

Luigi Giuliante


    CommentAdd your comment...

    3 answers

    1.  
      1
      0
      -1

      Not very refined, but it should work:


      variables
        string vNlsInternalTime
        string vUTCDateTime
        datetime vDateTime
      endvariables
      
      vNlsInternalTime = $nlsinternaltime
      $nlsinternaltime = "UTC"
      vUTCDateTime = "2019-06-06T08:58:42.1878669Z"
      ; replace all non numeric characters in the input string
      vUTCDateTime = $replace(vUTCDateTime, 1, "-", "", -1)
      vUTCDateTime = $replace(vUTCDateTime, 1, '&', "", -1)
      vUTCDateTime = $replace(vUTCDateTime, 1, ":", "", -1)
      vUTCDateTime = $replace(vUTCDateTime, 1, ".", "", -1)
      ; convert string to datetime
      vDateTime = $datim(vUTCDateTime[1:16])
      ; First value is the internal datetime value in UTC
      ; Second value (substituted string) is the local time
      putmess $concat(vDateTime, " - ", "%%vDateTime")
      $nlsinternaltime = vNlsInternalTime

      Result: 

      "2019060608584218 - 06-jun-19 10:58:42"

      I hope this helps.

      Kind regards,
      Daniel

        CommentAdd your comment...
      1.  
        1
        0
        -1

        Very perfect.


        Many thanks

        Luigi

        1. Daniel Iseli

          You are welcome.

          Kind regards,
          Daniel

        CommentAdd your comment...
      2.  
        1
        0
        -1

        Hi Daniel,

        I'll try it right away and thank you for your quick reply.


        My best regards

        Luigi Giuliante


          CommentAdd your comment...