Reputation: 2580
I would like to add a %custom
directive to strfime
that will translate months to the code used in some financial/trading reports
I've tried finding documentation on this but was not able to find. Any ideas? Thanks in advance!
Upvotes: 1
Views: 99
Reputation: 27793
Directives are hardcoded in strftime.c
and cannot be extended.
Maybe try this?
months = { "Jan" => "F", "Feb" => "G", ... }
Date.today.strftime('%b %d, %Y').gsub(Regexp.union(months.keys), months)
# => "F 08, 2017"
Upvotes: 2