Folks,
I am trying to open date handling ranges and maths up to a broader audience.
Background
We can use the day of year “0ddddd” (DOY) in both the now macro and date formats ($view widget and format operator) which allows us to quickly obtain the DOY for any date. If we prefixed this with the current year of the Form CCYY eg 2022 and can Zero fill the number eg 001 021 215 we end up with a sortable infinite (at least until 2100) serial date. We need only handle the change in year and 365/366 days.
To provide the tools to support his approach I want to find a way to easily do the following taking into account the number of days in any year;
- Zero fill the DOY to three digits we can use the pad[3] operator
- Convert a given CCYYNNN to a calendar date and reverse
- Provide and add and subtract days that throws to new years
All these can be coded with current macros and widgets, perhaps with the exception of CCYYNNN to calendar date, but I am keen to see if we can get a robust solution or extend existing tools.
[Edited]
- I think we need an additional form of ddddd with 0ddddd giving us the three digit day number with the pad[3] built in.
- Examples include add N multiples of 7 to a CCYYNNN for N weeks time
- Simple day ranges eg from one date to another add 20 days.
- A year from now can just use the matching NNN and change the CCYY
- If you want to set it to ± N months, quarters etc, you will need to use months and day of month etc…