I am getting a date as a string like below:
"September 1998"
I tried like Date.parse("September 1998")
, but it did not work.
How do I convert it into a ruby date object which returns string in above format?
Date.strptime('September 1998', '%B %Y')
. However, this will represent September 1st 1998, because date objects represent, well, dates.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With