Method: DateTime.httpdate
- Defined in:
- ext/date/date_core.c
.httpdate(string = 'Mon, 01 Jan -4712 00:00:00 GMT'[, start=Date::ITALY]) ⇒ Object
Creates a new DateTime object by parsing from a string according to some RFC 2616 format.
DateTime.httpdate('Sat, 03 Feb 2001 04:05:06 GMT')
#=> #<DateTime: 2001-02-03T04:05:06+00:00 …>
8106 8107 8108 8109 8110 8111 8112 8113 8114 8115 8116 8117 8118 8119 8120 8121 8122 8123 8124 |
# File 'ext/date/date_core.c', line 8106
static VALUE
datetime_s_httpdate(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("Mon, 01 Jan -4712 00:00:00 GMT");
case 1:
sg = INT2FIX(DEFAULT_SG);
}
{
VALUE hash = date_s__httpdate(klass, str);
return dt_new_by_frags(klass, hash, sg);
}
}
|