Tcl CLOCK function

Clovertech Forums Read Only Archives Cloverleaf Cloverleaf Tcl CLOCK function

  • Creator
    Topic
  • #52992
    Michael Lacriola
    Participant

      I want to be able to convert a date/time stamp into a string like below that would include the time as well. If I add the time on the end of the string in either HHMM or HHMMSS format, the proc fails. Any ideas? I’m interested in getting the Day, Month and CST (or CDT) portion of the returned string (0,1, and 4 if treating like a list).

      Notice that 20120311 was the time change date but CST is correct for 00:00:00, but not for 03:00:00. That is why I need the time included.

      tcl>set dt 20120311

      20120311

      tcl>

      tcl>clock format [clock scan $dt]

      Sun Mar 11 00:00:00 CST 2012

      tcl>

      tcl>set dt 201203111234

      201203111234

      tcl>

      tcl>clock format [clock scan $dt]

      Error: unable to convert date-time string “201203111234”

      tcl>

      tcl>set dt 20120311123456

      20120311123456

      tcl>

      tcl>clock format [clock scan $dt]

      Error: unable to convert date-time string “20120311123456”

      tcl>

    Viewing 1 reply thread
    • Author
      Replies
      • #76191
        James Cobane
        Participant

          Mike,

          Whenever you use the clock scan function, you need to separate the date and time with a space; then it should work.

          hcitcl>set dt “20120311 1234”

          20120311 1234

          hcitcl>clock format [clock scan $dt]

          Sun Mar 11 12:34:00 EDT 2012

          Hope this helps.

          Jim Cobane

          Henry Ford Health

        • #76192
          Michael Lacriola
          Participant

            Excellent. Thanks.

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