check this
Code:
set iojTQ(year) [clock format [clock seconds] -format "%Y" -gmt true]
set iojTQ(month) [clock format [clock seconds] -format "%m" -gmt true]
set iojTQ(time_month_begin) [clock scan "$iojTQ(month)/01/$iojTQ(year) 00:00:00" -gmt true]
set iojTQ(nmonth) [expr int([format %f [clock format [clock seconds] -format "%m" -gmt true]])+1]
if {$iojTQ(nmonth) == 13} {
set iojTQ(nmonth) 1
set iojTQ(year) [expr $iojTQ(year)+1]
}
set iojTQ(time_month_end) [clock scan "$iojTQ(nmonth)/01/$iojTQ(year) 00:00:00" -gmt true]