If I start with a string: "March", how can I get the integer for that month?
Use Date::MONTHNAMES:
Date::MONTHNAMES.index("June") => 6
Also note there is an equivalent for abbreviated month-names - Date::ABBR_MONTHNAMES:
Date::ABBR_MONTHNAMES.index("Jun") => 6
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