cancel
Showing results for 
Search instead for 
Did you mean: 

Parsing date for filtering

rpc1235x
New Contributor II

Hello, 

I am having trouble filtering dates in the Filter snap. 

I want to:

  1. Filter for a specific month and year, example June 2024
  2. If it's possible to add "OR" condition, then from 2 columns, otherwise one column is fine
  3. Values from the date column are in this format: "2018-08-27T00:00:00-04:00", "2018-12-22T00:00:00-05:00"

In the Filter snap, I have tried the following with no success:

  • Date.getDatePart(Date.parse($invoice_date), "MONTH") == 7 && Date.getDatePart(Date.parse($invoice_date), "YEAR") == 2024
  • Date.format(Date.parse($invoice_date), "MM") == "07" && Date.format(Date.parse($invoice_date), "yyyy") == "2024"
  • Date.getMonth(Date.parse($invoice_date)) == 7 && Date.getFullYear(Date.parse($invoice_date)) == 2024
  • Date.format(Date.parse($invoice_date), "MM") == "07" && Date.format(Date.parse($invoice_date), "yyyy") == "2024"
  • Date.extractDate(Date.parse($invoice_date), "MM") == "07" && Date.extractDate(Date.parse($invoice_date), "yyyy") == "2024"

I am thinking that I could also format the date as YYYY-MM-DD prior to inserting into the Filter snap. Any recommendations? Thank you!

#Filter #Date 

rpc1235x_0-1725301789865.png

 

1 REPLY 1

SpiroTaleski
Valued Contributor

@rpc1235x 

Have you checked the getFullYear() and getMonth() functions?