Skip to content

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

instance method

DateTime#jisx0301

dt.jisx0301([n=0]) → string

Returns a string in a JIS X 0301 format. The optional argument n is the number of digits for fractional seconds.

Example
DateTime.parse('2001-02-03T04:05:06.123456789+07:00').jisx0301(9)
                          #=> "H13.02.03T04:05:06.123456789+07:00"
See also .jisx0301 #iso8601 #min #hour also in 4.1 · 4.0 · 3.4 · 3.3 · 3.1 · 3.0