Skip to content

Preview Ruby 4.1 is a preview. It can change before the final release. Switch to Ruby 4.0 →

class method

DateTime.now

(?::Integer start) -> ::DateTime
DateTime.now([start=Date::ITALY]) → datetime

Creates a DateTime object denoting the present time.

Example
DateTime.now              #=> #<DateTime: 2011-06-11T21:20:44+09:00 ...>
See also .new .ordinal .jisx0301 .parse also in 4.0 · 3.4 · 3.3 · 3.2 · 3.1 · 3.0