Am 23.01.2023 um 07:37 schrieb Luc:
Today is 23 so tomorrow is 24, no problem.
But if today was the 30th, how would I know what day tomorrow is?
The 31st or the 1st?
clock format [clock add [clock seconds] 1 day] -format %d
Am 23.01.23 um 08:33 schrieb Harald Oehlmann:
Am 23.01.2023 um 07:37 schrieb Luc:Or use the free-form clock parser:
Today is 23 so tomorrow is 24, no problem.
But if today was the 30th, how would I know what day tomorrow is?
The 31st or the 1st?
clock format [clock add [clock seconds] 1 day] -format %d
clock format [clock scan tomorrow] -format %d
It also understands "now + 1 day" and similar things
Christian
Today is 23 so tomorrow is 24, no problem.
But if today was the 30th, how would I know what day tomorrow is?
The 31st or the 1st?
Easy. Just check what the month is.
But then I would need to maintain two lists:
30-day months and 31-day months.
And there is always February, of course. So I also have to check
if it's a leap year.
Or maybe I can just get today's Epoch, add 86400 seconds and get
the date corresponding to the resulting Epoch.
I can do all that by myself, but it definitely sounds like a wheel
that someone else has invented already.
Do you know of any? I would like to see what other tools there
might be in that toolbox.
I haven't found anything in Tcllib or Tclx.
On Monday, January 23, 2023 at 9:10:07 AM UTC+1, Harald Oehlmann wrote:
Am 23.01.2023 um 09:03 schrieb Christian Gollwitzer:
Am 23.01.23 um 08:33 schrieb Harald Oehlmann:Wow, I did not know this! You learn each day! Thanks,
Am 23.01.2023 um 07:37 schrieb Luc:Or use the free-form clock parser:
Today is 23 so tomorrow is 24, no problem.
But if today was the 30th, how would I know what day tomorrow is?
The 31st or the 1st?
clock format [clock add [clock seconds] 1 day] -format %d
clock format [clock scan tomorrow] -format %d
It also understands "now + 1 day" and similar things
Christian
Harald
You should be a bit careful with that: the free-form parser is a bit quirky, if I understand it correctly. One reason to stay with the more formal arithmetic.
Regards,
Arjen
Am 23.01.2023 um 09:03 schrieb Christian Gollwitzer:
Am 23.01.23 um 08:33 schrieb Harald Oehlmann:
Am 23.01.2023 um 07:37 schrieb Luc:Or use the free-form clock parser:
Today is 23 so tomorrow is 24, no problem.
But if today was the 30th, how would I know what day tomorrow is?
The 31st or the 1st?
clock format [clock add [clock seconds] 1 day] -format %d
clock format [clock scan tomorrow] -format %d
It also understands "now + 1 day" and similar things
ChristianWow, I did not know this! You learn each day! Thanks,
Harald
Today is 23 so tomorrow is 24, no problem.
But if today was the 30th, how would I know what day tomorrow is?
The 31st or the 1st?
Easy. Just check what the month is.
But then I would need to maintain two lists:
30-day months and 31-day months.
And there is always February, of course. So I also have to check
if it's a leap year.
Or maybe I can just get today's Epoch, add 86400 seconds and get
the date corresponding to the resulting Epoch.
I can do all that by myself, but it definitely sounds like a wheel
that someone else has invented already.
Do you know of any? I would like to see what other tools there
might be in that toolbox.
I haven't found anything in Tcllib or Tclx.
Today is 23 so tomorrow is 24, no problem.
But if today was the 30th, how would I know what day tomorrow is?
The 31st or the 1st?
Easy. Just check what the month is.
But then I would need to maintain two lists:
30-day months and 31-day months.
And there is always February, of course. So I also have to check
if it's a leap year.
Or maybe I can just get today's Epoch, add 86400 seconds and get
the date corresponding to the resulting Epoch.
I can do all that by myself, but it definitely sounds like a wheel
that someone else has invented already.
Do you know of any? I would like to see what other tools there
might be in that toolbox.
I haven't found anything in Tcllib or Tclx.
Am 23.01.2023 um 10:55 schrieb Arjen Markus:
On Monday, January 23, 2023 at 9:10:07 AM UTC+1, Harald Oehlmann wrote:
Am 23.01.2023 um 09:03 schrieb Christian Gollwitzer:
Am 23.01.23 um 08:33 schrieb Harald Oehlmann:Wow, I did not know this! You learn each day! Thanks,
Am 23.01.2023 um 07:37 schrieb Luc:Or use the free-form clock parser:
Today is 23 so tomorrow is 24, no problem.
But if today was the 30th, how would I know what day tomorrow is?
The 31st or the 1st?
clock format [clock add [clock seconds] 1 day] -format %d
clock format [clock scan tomorrow] -format %d
It also understands "now + 1 day" and similar things
Christian
Harald
You should be a bit careful with that: the free-form parser is a bit
quirky, if I understand it correctly. One reason to stay with the more
formal arithmetic.
Regards,
Arjen
Yes, and it is depreciated. So, maybe remove it in 9.0 ;-).
But the solution by Christian is just beautiful !
| Sysop: | Keyop |
|---|---|
| Location: | Huddersfield, West Yorkshire, UK |
| Users: | 715 |
| Nodes: | 16 (2 / 14) |
| Uptime: | 152:06:36 |
| Calls: | 12,091 |
| Calls today: | 4 |
| Files: | 15,000 |
| Messages: | 6,517,631 |