Method: DateTime#xmlschema

Defined in:
ext/date/date_core.c

#iso8601([n = 0]) ⇒ String #xmlschema([n = 0]) ⇒ String

This method is equivalent to strftime(‘%FT%T%:z’). The optional argument n is the number of digits for fractional seconds.

DateTime.parse('2001-02-03T04:05:06.123456789+07:00').iso8601(9)

#=> “2001-02-03T04:05:06.123456789+07:00”

Overloads:

  • #iso8601([n = 0]) ⇒ String

    Returns:

    • (String)
  • #xmlschema([n = 0]) ⇒ String

    Returns:

    • (String)


8384
8385
8386
8387
8388
8389
8390
8391
8392
8393
8394
8395
# File 'ext/date/date_core.c', line 8384

static VALUE
dt_lite_iso8601(int argc, VALUE *argv, VALUE self)
{
    long n = 0;

    rb_check_arity(argc, 0, 1);
    if (argc >= 1)
  n = NUM2LONG(argv[0]);

    return rb_str_append(strftimev("%Y-%m-%d", self, set_tmx),
       iso8601_timediv(self, n));
}