changing date format

Clovertech Forums Read Only Archives Cloverleaf Cloverleaf changing date format

  • Creator
    Topic
  • #50023
    Gary Atkinson
    Participant

      Hello-

      I have a date in the format of 5/8/2008 10:09:00 AM in which I would like to convert to 200805081109 (YYYYMMDDTTTT); the TTTT would be in military time.  I have asked the vendor to correct the format, but I would like try to change it using Tcl in case they come back and say they can not change it.  Does anyone have some Tcl code they would be willing to share?  

      Thanks in advance,

      Gary

    Viewing 2 reply threads
    • Author
      Replies
      • #64558
        Kevin Kinnell
        Participant

          Gary — you need the clock scan and clock format command.

          Get into Tcl and do an ‘help clock’.

        • #64559
          Charlie Bursell
          Participant

            set dt “5/8/2008 10:09:00 AM”

            clock format [clock scan $dt] -format %Y%m%d%H%M%S

            ==> 20080508100900

          • #64560
            Gary Atkinson
            Participant

              Thanks Charlie!   The code works great

          Viewing 2 reply threads
          • The forum ‘Cloverleaf’ is closed to new topics and replies.