Skip to content

End of Life Ruby 3.0 has reached end of life and gets no more fixes. Switch to Ruby 4.0 →

class method

DateTime.jisx0301

DateTime.jisx0301(string='-4712-01-01T00:00:00+00:00'[, start=Date::ITALY], limit: 128) → datetime

Creates a new DateTime object by parsing from a string according to some typical JIS X 0301 formats.

Example
DateTime.jisx0301('H13.02.03T04:05:06+07:00')
                          #=> #<DateTime: 2001-02-03T04:05:06+07:00 ...>

For no-era year, legacy format, Heisei is assumed.

Example
DateTime.jisx0301('13.02.03T04:05:06+07:00')
                          #=> #<DateTime: 2001-02-03T04:05:06+07:00 ...>

Raise an ArgumentError when the string length is longer than limit. You can stop this check by passing ‘limit: nil`, but note that it may take a long time to parse.

See also #jisx0301 .jd .json_create .iso8601 also in 4.1 · 4.0 · 3.4 · 3.3 · 3.2 · 3.1