Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-10-2021 01:23 AM
The trick is to make sure your columns are recognized as dates, otherwise they will be evaluated as strings.
"to_date(<datecol>, <date_format>) " does exactly this.
datecol is your column containing the date values, and date_format is the format in which your existing date is formatted. In your case "MM/dd/yyyy".
This will return values of spark dateType.
When they are recognized as dates, you can start calculating with them.