Version 2 of Quick Access to Formatted Date & Time

Updated 2006-02-11 16:44:38

WJG (11/02/06) Just one of those handy code snippets that can be appended to a bag of support procs.

 #---------------
 # lazy way to get preformated time and date
 #---------------
 proc date { {i date} } {
  switch -- $i {
    d&t   { set f "%c"}
    year  { set f "%Y" }
    week  { set f "%W" }
    day   { set f "%A" }
    month { set f "%B" }
    time  { set f "%H:%M:%S" }
    date  { set f "%d/%m/%y" }
  }
  return [clock format [clock seconds] -format "$f"]
 }