How to convert a string into specific date format ?

Clovertech Forums Read Only Archives Cloverleaf Tcl Library How to convert a string into specific date format ?

  • Creator
    Topic
  • #51926
    Ganesan Murali
    Participant

      How do we convert a string into specific date format ?

      Input string:

      20100628153744

      Output should be

      28-June-2010 03.37.44 PM

      Pls help.?

    Viewing 1 reply thread
    • Author
      Replies
      • #72332

        Use the tcl clock command. clock has a format option.

        -- Max Drown (Infor)

      • #72333
        Keith McLeod
        Participant

          hcitcl>set dt 20100628153744

          20100628153744

          hcitcl>regsub — {(d{8})(d*)} $dt {1 2} dt

          1

          hcitcl>echo $dt

          20100628 153744

          hcitcl>clock format [clock scan $dt] -format “%d-%B-%Y %I.%M.%S %p”

          28-June-2010 03.37.44 PM

      Viewing 1 reply thread
      • The forum ‘Tcl Library’ is closed to new topics and replies.