Sujet : Re: what's the best way to get today at 00:00:00?
De : rich (at) *nospam* example.invalid (Rich)
Groupes : comp.lang.tclDate : 24. Jul 2025, 17:31:10
Autres entêtes
Organisation : A noiseless patient Spider
Message-ID : <105tn4d$1hcgg$1@dont-email.me>
References : 1 2
User-Agent : tin/2.6.1-20211226 ("Convalmore") (Linux/5.15.139 (x86_64))
Rich <
rich@example.invalid> wrote:
Mark Summerfield <m.n.summerfield@gmail.com> wrote:
I have a function that returns today's date/time at 00:00:00, e.g.,
2025-07-24T00:00:00, returned as seconds:
proc start_of_day {} {
clock scan "[clock format now -format %Y]-[clock format now \
-format %m]-[clock format now -format %d]" -format "%Y-%m-%d"
}
Is there a better way?
proc start_of_day {} {
return [clock format [clock seconds] -format "%Y-%m-%dT00:00:00"]
}
Ah, missed the "returned as seconds".
proc start_of_day {} {
return [clock scan [clock format [clock seconds] -format "%Y-%m-%dT00:00:00"] -format %Y-%m-%dT%H:%M:%S]
}