How do I get the current month in tcl?

datetime, tcl

Solution

What you need is the `clock` command.

http://www.tcl.tk/man/tcl8.5/TclCmd/clock.htm#M7

To get the textual representation of the month, use:

clock format [clock seconds] -format %B

And the numeric representation:

clock format [clock seconds] -format %N

Problem

How do I get the current month as an integer, and as a string? So for this month, I would want "7" and the string "July". Is there an easy way to do this without a lot of string parsing and a lookup list for month names?

Original source