Ruby 1.8.7 リファレンスマニュアル > ライブラリ一覧 > dateライブラリ > DateTimeクラス
クラスの継承リスト: DateTime < Date < Comparable < Object < Kernel
日付だけでなく時刻も扱える Date のサブクラスです。
require 'date' a = DateTime.new(1993, 2, 24, 12, 30, 45) b = DateTime.parse('1993-02-24T12:30:45') b += 10 b - a #=> 10 b.year #=> 1993 b.strftime('%a') #=> "Sat" yesterday = DateTime.now - 1
定義 | 説明 | |
---|---|---|
hour -> Integer
|
時間を返します (0-23)。 |
|
min -> Integer
|
分を返します (0-59)。 |
|
new_offset(offset = 0) -> DateTime
|
self を複製して、その時差を設定しなおします。 引数を省略した場合は、零 (協定世界時) になります。 |
|
offset -> Rational
|
時差を返します。 |
|
sec -> Integer
|
秒を返します (0-59)。 |
|
zone -> String
|
タイムゾーンを返します。 |
<
<=
==
>
>=
between?
+
-
<<
<=>
===
>>
ajd
amjd
asctime
cwday
cweek
cwyear
day
downto
england
gregorian
gregorian?
italy
jd
julian
julian?
ld
leap?
mjd
mon
new_start
next
start
step
strftime
to_s
upto
wday
yday
year
._parse
.gregorian_leap?
.julian_leap?
.valid_civil?
.valid_commercial?
.valid_jd?
.valid_ordinal?
::ENGLAND
::GREGORIAN
::ITALY
::JULIAN
=~
__id__
__send__
_dump
class
clone
dclone
display
enum_for
eql?
equal?
extend
freeze
frozen?
hash
initialize
initialize_copy
inspect
instance_eval
instance_exec
instance_of?
instance_variable_defined?
instance_variable_get
instance_variable_set
instance_variables
is_a?
marshal_dump
marshal_load
method
method_missing
methods
nil?
pretty_inspect
pretty_print
pretty_print_cycle
pretty_print_inspect
pretty_print_instance_variables
private_methods
protected_methods
public_methods
remove_instance_variable
respond_to?
singleton_method_added
singleton_method_removed
singleton_method_undefined
singleton_methods
taint
tainted?
tap
to_a
to_ary
to_hash
to_int
to_io
to_proc
to_regexp
to_str
to_yaml
to_yaml_properties
to_yaml_style
untaint