Creating a date based on another date

I want to create a date based on system date. The reference date is 1st July of each year. If the the system date is greater that 1st July of that year, the new date column should store 1st July of that year as the date. Otherwise, if the system date is less than 1st July of that year, it should store 1st July of last year as the date.

For e.g
sysdate= 01/08/2020(DD/MM/YYYY)
then new_date_stored = 01/07/2020

sysdate= 01/06/2020(DD/MM/YYYY)
then new_date_stored = 01/07/2019

How can this be implemented?

Hi @clonedapple , this should work for you:

Input (I added a few more samples):


Creating a date based on another date.knwf (17.6 KB)

FYI: The date format (DD/MM/YYYY vs YYYY-MM-DD) depends on your locale (Region). It’s only a display thing. On my computer, the region is set for the YYYY-MM-DD format.


Thank you! This helped!

1 Like

Hello there,

this seems like a good use case for Column Expressions node as a one node solution using it’s Date&Time functions:

if( getMonthOfYear(column("sysdate")) >= 7)
    date( getYear( column("sysdate")), 7, 1)
    date( getYear(column("sysdate")) - 1, 7, 1)


1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.