Sunday, September 8, 2013

TCL and the Blasted Dates!

So, I've had a programming task to do on TCL that involves things that I don't normally use.  This one was basically to take the first Sunday of a specific Month and Year.  After some time of researching and testing, I figured it out.  This entry is just for archival purposes.

% clock format [clock scan {Sunday} -base [clock scan "2013-05-01" -format {%Y-%m-%d}] -format {%A}] -format {%Y-%m-%d}

Base sets the base time for clock and the format for the return can be tweaked to whatever you want.  It's also worth taking note that -format parameter on clock scan only works on TCL 8.5 and above.

No comments: