Maintenance Ruby 3.4 gets fixes, but no new features. Switch to Ruby 4.0 →
instance method
DateTime#rfc3339
(?::Integer n) -> ::String
dt.rfc3339([n=0]) → string
ext/date/date_core.c
View on GitHub ↗
static VALUE
dt_lite_rfc3339(int argc, VALUE *argv, VALUE self)
{
return dt_lite_iso8601(argc, argv, self);
}
This method is equivalent to strftime(‘%FT%T%:z’). The optional argument n is the number of digits for fractional seconds.
Example
DateTime.parse('2001-02-03T04:05:06.123456789+07:00').rfc3339(9) #=> "2001-02-03T04:05:06.123456789+07:00"