Time Zone Conversion

Homepage Clovertech Forums Read Only Archives Cloverleaf Tcl Library Time Zone Conversion

  • Creator
    Topic
  • #50667
    Don Anderson
    Participant

    HAs anyone done Time Zone Conversions?

    I need to convert the time for all time zones for the US

    Thanks in advance

Viewing 0 reply threads
  • Author
    Replies
    • #67043
      Don Anderson
      Participant

      set date $xlateInVals

      set dt [clock format [clock scan [exec $date]] -format %Y%m%d%H%M]

      set xlateOutVals $dt

      args: should be “clock format clockval ?-format string? ?-gmt boolean?”

      #####################################################################

      ##

      # XLT call action (code fragment)  DISCH Time Zone Conversion

      #

      # danderson 2/3/09

      #

      lassign $xlateInVals facility ts

      echo $ts

      if {$ts == “”} {

      set xlateOutVals “”

      } else {

      set yyyy [csubstr $ts 0 4]

      set MM [csubstr $ts 4 2]

      set dd [csubstr $ts 6 2]

      set hh [csubstr $ts 8 2]

      set mm [csubstr $ts 10 2]

      set ss [csubstr $ts 12 2]

      set admit “$MM/$dd/$yyyy $hh:$mm:$ss”

      switch -exact — $facility {

      BOSTON {set tz 0}

      CANADA {set tz 0}

      CINCINNATI {set tz 0}

      ERIE {set tz 0}

      GREENVILLE {set tz 0}

      LEXINGTON {set tz 0}

      PHILADELPHIA {set tz 0}

      SPRINGFIELD {set tz 0}

      TAMPA {set tz 0}

      CHICAGO {set tz 1}

      GALVESTON {set tz 1}

      HOUSTON {set tz 1}

      MEXICO {set tz 1}

      SHREVEPORT {set tz 1}

      STLOUIS {set tz 1}

      TWINCITES {set tz 1}

      INTERMOUNTAIN {set tz 2}

      LOSANGELES {set tz 3}

      NCALIFORNIA {set tz 3}

      PORTLAND {set tz 3}

      SPOKANE {set tz 3}

      HONOLULU {set tz 5}

      }

      set epoch [convertclock $admit]

      set adj_epoch [expr $epoch – {$tz * 3600}]

      set new_admit [clock format $adj_epoch -format %Y%m%d%H%M%S]

      set xlateOutVals $new_admit

      }

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

Forum Statistics

Registered Users
5,126
Forums
28
Topics
9,296
Replies
34,439
Topic Tags
287
Empty Topic Tags
10