I have a string in date format. It would be "2020-09-30", "09-30-2020", etc. I would like to get back the Format directives of the date string.
For example, if the string is "2020-09-30", I would like to get back "%Y-%m-%d".
I have a string in date format. It would be "2020-09-30", "09-30-2020", etc. I would like to get back the Format directives of the date string.
For example, if the string is "2020-09-30", I would like to get back "%Y-%m-%d".
Check the below link by tweaking some the methods a bit you can get the desired result https://railsexamples.com/ruby-date-formatting/