Method: DateTime.rfc3339

Defined in:
ext/date/date_core.c

.rfc3339(string = '-4712-01-01T00:00:00+00:00'[, start=Date::ITALY]) ⇒ Object

Creates a new DateTime object by parsing from a string according to some typical RFC 3339 formats.

DateTime.rfc3339('2001-02-03T04:05:06+07:00')

#=> #<DateTime: 2001-02-03T04:05:06+07:00 …>



8015
8016
8017
8018
8019
8020
8021
8022
8023
8024
8025
8026
8027
8028
8029
8030
8031
8032
8033
# File 'ext/date/date_core.c', line 8015

static VALUE
datetime_s_rfc3339(int argc, VALUE *argv, VALUE klass)
{
    VALUE str, sg;

    rb_scan_args(argc, argv, "02", &str, &sg);

    switch (argc) {
      case 0:
  str = rb_str_new2("-4712-01-01T00:00:00+00:00");
      case 1:
  sg = INT2FIX(DEFAULT_SG);
    }

    {
  VALUE hash = date_s__rfc3339(klass, str);
  return dt_new_by_frags(klass, hash, sg);
    }
}