This is not an alternate to @brookter’s solution. Go with that. The following is just colouring in some of the contingent part of the process.
These date format codes are how we tell Tinderbox that from a Date-type value (which internally is number though you never see it) we want a String-type values of all or some of the data, which we do using used by Date.format(formatStr).
Thus format string "D"
asks: from the source Date data, find the calendar day number and give it to me as a two character string. Thus, 2 February the "D"
value would be "02"
and for 14 February it would be "14"
. Format "M0"
(M zero) does the same for the Date’s calendar month.
@brookter is quite right to note the scope for error with dd/mm (rest of world) vs. mm/dd (USA) ordering in some numeral date formats. His method neatly sidesteps that because as day and month are read discretely the query doesn’t involve d/m order. So the query works regardless.
We can do the functionally the same query as above but comparing numbers and not text by using Date.day() and Date.month(). Below, the line breaks in the query are only for legibility here:
($PublicationDate.day == date("today").day)
&
($PublicationDate.month == date("today").month)
Note this is not better/more efficient query than @brookter’s approach (certainly not at the power of a current Mac). Rather, it is just another way to do the same thing, as is so often possible in Tinderbox.
Noting that .day()
and month()
return either a one or two digit number, reminds us the the number of digits doesn’t matter as in the scenario a correct query outcome will match the number of characters and their value owing to the logic of their creation—even if the number of characters varies from date to date.
Therefore, we could also use the first .format()
method but replacing format strings "D"
and "M0"
with "d"
and "m"
. The result/efficiency is the same. So why have the two different formats for the same info. Well, it all depends if the next thing you’ll do needs a fixed number of characters, i.e. ‘02’ vs. ‘2’ such as affects the first nine day of a month and similarly the first none months in a year.
TL;DR? Use the query in the previous post. 