Page 1 of 1

Suggestion for additional template Date/Time variables

Posted: Tue Jan 12, 2016 12:24 am
by Tiktok
Date selectors currently available for templates give only numeric values for day and month but do not give string values for day of week (e.g Monday, Tuesday...) or month (January, February...).

Would you consider extending the selectors at some point to include these options?

Possibly [DDD] gives abbreviated Mon, Tue, Wed ... whilst [DDDD] gives Monday, Tuesday, Wednesday ...
Similarly, [MMM] gives Jan, Feb, Mar ... and [MMMM] gives January, February, March ...

Alternatives to fit the current language patterns could be [enDDD], [deDDD], [nlDDD] etc.

It would at least save me from writing the following to get the number for day of week to use in a conditional expression (Sunday is 0, Monday is 1 etc) :D

Code: Select all

{*([D] + (([M]<3) * floor(2.6*([M]+10) -0.2)) + (([M]>2) * floor(2.6*([M]-2) -0.2))+(([M]>3)*([YY] +floor([YY]/4) + floor([YYYY]/400) -2*[YYYY]/100))+(([M]<3)*([YY]-1 +floor(([YY]-1)/4) + floor([YYYY]/400) -2*[YYYY]/100)) ) % 7 *}

Re: Suggestion for additional template Date/Time variables

Posted: Tue Jan 12, 2016 12:36 am
by Tiktok
A follow up note - minor point - the wiki article on Numerical Expressions doesn't mention that brackets can be used to override the given operator precedence :

Code: Select all

{*2*3+3*}

{*2*(3+3)*}
These give 9.00 and 12.00 as expected whilst undocumented.