Strptime doesn't support all formats which is supported by Time.strptime. It is OK for my use case (except %b for apache access log, I will send a pull request later).
But I want to know given format string is valid or not on Strptime gem to fall back to Time.strptime.
My ideas are
Strptime.valid_format?(fmt)
> Strptime.valid_format?("%s") => false
raise error
> Strptime.new("%s") => ArgumentError: invalid format %s
Strptime doesn't support all formats which is supported by
Time.strptime
. It is OK for my use case (except %b for apache access log, I will send a pull request later). But I want to know given format string is valid or not on Strptime gem to fall back toTime.strptime
. My ideas areStrptime.valid_format?(fmt)
Any thoughts?