Given an input timestamp value for the local timezone, this procedure returns the equivalent value for the UTC timezone. In other words, a localtime 9 or 15 format value, "YYYY-MM-DD HH:MM:SS[.uuuuuu]" can be converted to a format 10 or 16 value. For timezones that observe Daylight Saving Time, results for values in the hour in the fall when the localtime values are repeated are problematic. For the reverse conversion, the mktime command is able to convert UTC values to local timezone values.
The command is part of the Humelib package and can be imported from the namespace humelib.
package require Humelib set ts_local [localtime 9] set ts_utc [humelib::ts_to_utc $ts_local] puts "local ts=$ts_local UTC ts=$ts_utc"