Maintenance Ruby 3.3 gets fixes, but no new features. Switch to Ruby 4.0 →
class method
Date._strptime
Date._strptime(string, format = '%F') → hash
ext/date/date_core.c
View on GitHub ↗
static VALUE
date_s__strptime(int argc, VALUE *argv, VALUE klass)
{
return date_s__strptime_internal(argc, argv, klass, "%F");
}
Returns a hash of values parsed from string according to the given format:
Example
Date._strptime('2001-02-03', '%Y-%m-%d') # => {:year=>2001, :mon=>2, :mday=>3}
For other formats, see Formats for Dates and Times. (Unlike Date.strftime, does not support flags and width.)
See also strptime(3).
Related: Date.strptime (returns a Date object).