See http://purl.org/tcl/home/man/tcl8.4/TclCmd/clock.htm for the formal man page.
From news:comp.lang.tcl, I see: Date: Mon Mar 19 15:41:16 EST 2001 From: Jeff Hobbs <[email protected]> Organization: ActiveState - Programming for the People [email protected] wrote: Is there a way to do the following by using the clock command: If I have a date in the future, for example Mar 26, 2001 I need to find out what the date for that Saturday is. (Sat Mar 31, 2001) Apr 30, 2001 = Sat May 5, 2001 Mar 28, 2001 = Sat May 5, 2001 (hobbs) 50 % clock format [clock scan "Saturday" \ -base [clock scan "Apr 30, 2001"]] Sat May 05 00:00:00 Pacific Daylight Time 2001 (hobbs) 51 % clock format [clock scan "Saturday" \ -base [clock scan "Mar 28, 2001"]] Sat Mar 31 00:00:00 Pacific Standard Time 2001
You can format relative time in seconds to h:m:s format. Just make sure you pretend to be in Greenwich( -gmt 1), otherwise your local timezone may be added. (RS)
clock format 711 -format %H:%M:%S -gmt 1 01:11:51
Traditional degrees: clock format can be put to un-timely uses. As degrees especially in geography are also subdivided in minutes and seconds, how's this one-liner for formatting decimal degrees:
proc dec2deg x {concat [expr int($x)]� [clock format [expr round($x*3600)] -format "%M' %S\""]}
An additional -gmt 1 switch is needed if you happen to live in a non-integer timezone. (RS)
Want to format the modification time of a specific file? Try
clock format [file mtime "/path/to/my/file"]
where you replace /path/to/my/file with the path you want. Or replace it with a variable containing the path.
Tcl syntax help - Arts and crafts of Tcl-Tk programming - Date and Time Issues - Category Command