Suggestion for additional template Date/Time variables

All about the standard Meteobridge devices based on mobile routers from TP-Link, D-Link, ASUS

Moderator: Mattk

Post Reply
Tiktok
Fresh Boarder
Fresh Boarder
Posts: 15
Joined: Sat Jan 09, 2016 11:52 pm

Suggestion for additional template Date/Time variables

Post 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 *}
Last edited by Tiktok on Tue Jan 12, 2016 9:12 am, edited 1 time in total.
Tiktok
Fresh Boarder
Fresh Boarder
Posts: 15
Joined: Sat Jan 09, 2016 11:52 pm

Re: Suggestion for additional template Date/Time variables

Post 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.
Post Reply