Removing Year from {{NOW}} with date formatter

Need to filter a table with DOB’s in them for example: 1971-03-30
However I want to add the following into the query:
dob between. {{NOW.formatDate(“MM-dd”)}}. AND {{NOW.formatDate(“MM-dd”).dateAdd(“days”, 20)}}

So this way I can list birthdays coming up in the next 20 days.

How on earth can I get this to work??
Have spent hours on this now, trying to get it to work and it just won’t.

The problem is unless I can format the date I cannot filter it on day and month for use with an upcoming birthdays part and the {{NOW}} will always give the current year and 1971 is WAY more than 20 days to go.

Pretty frustrated by this now and hoping someone can help.

Got some pretty major IT issues here Peter so cant actually test anything out but i think the method needs to be something like.

Convert date to string => split on separator into year, month, day on separator (’-’) => rebuild string replacing year with current year => convert back to date

As i say, cant test it at present but think the formatter should be able to do that.

Hope to have everything IT wise back online tomorrow so will see what i can come up with

1 Like

Maybe you can just create a view in MySQL that always return the data filtered as you want it.

See

Problem is @george, it is to detect birthdays so the entry may be say, 1958-01-19 and the check needs to be with reference to the month and day only

So if today, 2019-04-19 the query needs to find all dates of birth with a month and day between 04-19 and 05-09 regardless of year.

Starting to think the Dates of both need to be stored in separate fields i.e. month and day of month separately or even as a day number i.e. 1 - 365 (or 366, leap years become an issue due to 1 day shift)

Maybe you could use MySQL Date_Format:

DATE_FORMAT(date,'%D%m')

To format the day/month in to a View then query the view?

https://www.w3schools.com/sql/func_mysql_date_format.asp

@Hyperbytes cheers, hope you get your IT issues sorted out. .
I’ll have a play with it today to see if I can do it. But yes if you could let me know if you get it working that would be awesome.