Find max date
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-10-2021 09:05 AM
Hi,
How can we find the max between dates?
I’m trying to find the newly created date between the dates below.
2021-05-19T19:01:47.000+0000
2021-05-19T22:11:26.000+0000
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-10-2021 09:38 AM
Hi,
In a mapper snap you can use this expression to return the date that is earlier(or equal) if your dates are strings, otherwise if the values are already Dates, you can remove the calls to Date.parse():
Date.parse($date1) > Date.parse($date2) ? $date2 : $date1
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-10-2021 09:51 AM
@cjhoward18 Thanks, for your quick response. But those two dates will be in the same column. How can I find the recently created date from the same column?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-10-2021 10:14 AM
Check out the Aggregate snap:
https://docs-snaplogic.atlassian.net/wiki/spaces/SD/pages/1438462/Aggregate
I used the snap configured like this screenshot below with a series of documents from a json generator that have a field called date1
. Applying the Max function allowed me to find the Max date:
** correction I misread the post, you would want to use the MAX function not MIN.
