TCL命令让我可以得到以前的月份?

TCL command so that I can get the previous month?

您好,我希望我的脚本是上个月的 运行。 TCL有没有快捷命令可以获取上个月的信息?

#Get the current month as an integer (%k format is month without leading zero)
set month_num [clock format [clock seconds] -format %k]

# Get prev month number.
set prev_month_num [expr {$month_num - 1}]

# Shortcut here to avoid using "clock scan" or "clock format" more than necessary.
set prev_month [lindex "Dec Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov" $prev_month_num]

No language (AFAIK) has a single command for such an obscure op.

不是一个命令,但 Tcl 会让您大吃一惊:

clock format [clock scan "last month"] -format %B