method
to_date
v2_6_3 -
Show latest stable
- Class:
DateTime
to_date()public
Returns a Date object which denotes self.
static VALUE
datetime_to_date(VALUE self)
{
get_d1a(self);
if (simple_dat_p(adat)) {
VALUE new = d_lite_s_alloc_simple(cDate);
{
get_d1b(new);
bdat->s = adat->s;
bdat->s.jd = m_local_jd(adat);
return new;
}
}
else {
VALUE new = d_lite_s_alloc_simple(cDate);
{
get_d1b(new);
copy_complex_to_simple(new, &bdat->s, &adat->c);
bdat->s.jd = m_local_jd(adat);
bdat->s.flags &= ~(HAVE_DF | HAVE_TIME | COMPLEX_DAT);
return new;
}
}
} Related methods
- Instance methods
- as_json
- hour
- iso8601
- jisx0301
- min
- minute
- new_offset
- offset
- rfc3339
- sec
- sec_fraction
- second
- second_fraction
- strftime
- to_date
- to_datetime
- to_json
- to_s
- to_time
- xmlschema
- zone
- Class methods
- _strptime
- civil
- commercial
- httpdate
- iso8601
- jd
- jisx0301
- json_create
- new
- now
- nth_kday
- ordinal
- parse
- rfc2822
- rfc3339
- rfc822
- strptime
- weeknum
- xmlschema