Preview Ruby 4.1 is a preview. It can change before the final release. Switch to Ruby 4.0 →
class method
Date._iso8601
(::String str) -> ::Hash[::Symbol, ::Integer]
Date._iso8601(string, limit: 128) → hash
ext/date/date_core.c
View on GitHub ↗
static VALUE
date_s__iso8601(int argc, VALUE *argv, VALUE klass)
{
VALUE str, opt;
rb_scan_args(argc, argv, "1:", &str, &opt);
if (!NIL_P(str)) str = check_limit(str, opt);
return date__iso8601(str);
}
Returns a hash of values parsed from string, which should contain an ISO 8601 formatted date:
Example
d = Date.new(2001, 2, 3) s = d.iso8601 # => "2001-02-03" Date._iso8601(s) # => {:mday=>3, :year=>2001, :mon=>2}
See argument limit.
Related: Date.iso8601 (returns a Date object).