method
to_datetime
v2_4_6 -
Show latest stable
- Class:
Time
to_datetime()public
Returns a DateTime object which denotes self.
static VALUE
time_to_datetime(VALUE self)
{
VALUE y, sf, nth, ret;
int ry, m, d, h, min, s, of;
y = f_year(self);
m = FIX2INT(f_mon(self));
d = FIX2INT(f_mday(self));
h = FIX2INT(f_hour(self));
min = FIX2INT(f_min(self));
s = FIX2INT(f_sec(self));
if (s == 60)
s = 59;
sf = sec_to_ns(f_subsec(self));
of = FIX2INT(f_utc_offset(self));
decode_year(y, -1, &nth, &ry);
ret = d_complex_new_internal(cDateTime,
nth, 0,
0, sf,
of, DEFAULT_SG,
ry, m, d,
h, min, s,
HAVE_CIVIL | HAVE_TIME);
{
get_d1(ret);
set_sg(dat, DEFAULT_SG);
}
return ret;
} Related methods
- Instance methods
- +
- -
- <=>
- as_json
- asctime
- ctime
- day
- dst?
- eql?
- friday?
- getgm
- getlocal
- getutc
- gmt?
- gmt_offset
- gmtime
- gmtoff
- hash
- hour
- httpdate
- initialize_copy
- inspect
- isdst
- iso8601
- localtime
- mday
- min
- mon
- monday?
- month
- nsec
- rfc2822
- rfc822
- round
- saturday?
- sec
- strftime
- subsec
- succ
- sunday?
- thursday?
- to_a
- to_date
- to_datetime
- to_f
- to_i
- to_json
- to_r
- to_s
- to_time
- tuesday?
- tv_nsec
- tv_sec
- tv_usec
- usec
- utc
- utc?
- utc_offset
- w3cdtf
- wday
- wednesday?
- xmlschema
- yday
- year
- zone
- Class methods
- at
- gm
- httpdate
- iso8601
- json_create
- local
- mktime
- new
- now
- parse
- rfc2822
- rfc822
- strptime
- utc
- w3cdtf
- xmlschema
- zone_offset
- Private methods
-
apply_offset -
force_zone! -
make_time -
month_days -
zone_utc? -
_dump -
marshal_dump -
marshal_load