Hi Mark,

I know you've asked for a solution using core tools but I'm attaching a JS 
macro I made anyway in case you'd decide to use it.

The invocation is <<FutureDate YYYYMMDD y m d>> (y=years, m=months, 
d=days), so for example for 2 months and 15 days from the 1 December 2019 
you would put <<FutureDate 20191201 0 2 15>>.

If you wish to calculate time from now, use:

\define date_offset()
<$set name=today value=<<now YYYY0MM0DD>>>
<<date_offset_2>>
</$set>
\end

\define date_offset_2()
<<FutureDate $(today)$ 0 0 90>>
\end

<<date_offset>>

The macro also works with negative numbers, so "Future" Date isn't very 
accurate in terms of name (feel free to rename, adjust, etc). The macro 
works on full days only (disregards time), so it doesn't care what timezone 
you're in, doesn't convert to UTC etc., it just adds/subtracts full years, 
months or days from the current (local) date.

The output is in the same format as the <<now>> macro, so YYYY0MM0DD 
(though without hours, minutes, seconds, etc. as it's time-agnostic). you 
can easily modify this macro if you wish a different output.

Please read the description. 

Macro to find a future date based on the number of years, months or days from 
today.

Required input:
<<FutureDate YYYYMMDD y m d>>,
where YYYYMMDD is the starting date and y, m, d are, respectively, year(s), 
month(s) and/or day(s) to be added to the starting date.

*Don't add more than 12 months in one parameter -- for example, instead of 
adding 18 months, add 1 year and 6 months*.


Enjoy!

Hubert

On Tuesday, 15 October 2019 02:41:46 UTC+1, TonyM wrote:
>
> Mark,
>
> I have successfully used Evans formulae plugin for this, however the 
> native method I know of is as follows;
>
> Although the days operator will not return the date for you to make use of 
> it will be able to find tiddlers in which contain a standard date field 
> that comply with the days operator, so you would use days[+6] days[+10] 
> days[+90] to look that many days into the future.
>
> you can then utilise a second days operator to eliminate days prior to 
> today.
>
> Here is a reply that I did in the past 
> <https://groups.google.com/d/msg/tiddlywiki/fbszxrvatvA/kCQzCDFwAAAJ>that 
> helps using the days operator but not the use of two at once.
>
> The trick I have found with the days operator is it is always relative to 
> today, ie +4 or -4 represents dates passing through today
>
>    - + 4 all dates in the future back today and further into the past
>    - - 4 all days from 4 days ago through today in into the future
>
> So (without retesting} [days[+4]days[-1] would be all dates upto 4 days in 
> the future and also from yesterday (including those in the future).
> Since the days operator returns the tiddler titles, from which you can 
> extract the date that resulted from the days operator, you can do more with 
> the date if required.
>
> Warnings
>
>    - It is quite easy to use two days operators that result in nothing 
>    because you eliminate all
>    - Using the not ! and the + and - values can quickly trip you up 
>    because you are doing binary backflips, double negatives etc.. 
>
>
> On Wednesday, August 21, 2019 at 12:11:35 AM UTC+10, Mark S. wrote:
>>
>> Or better yet, "6 days from given date."
>>
>> Yes, I know there are plugins to allow additional math abilities.
>>
>> But is there any way to do date math with existing core tools? Since 
>> there are a bunch of new math tools? I didn't see anything
>> that looked like it could do date math, but maybe I'm missing something?
>>
>> In particular, I'd like to calculate  6, 10, 90 days out.
>>
>> Thanks!
>>
>

-- 
You received this message because you are subscribed to the Google Groups 
"TiddlyWiki" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tiddlywiki/6bca8133-4497-4a20-9af9-4d531c079e67%40googlegroups.com.

Attachment: $___Macros_FutureDate.js.json
Description: application/json

Reply via email to