now

DateTime.now([start=Date::ITALY]) â datetime Class Public methods Creates a date-time object denoting the present time. DateTime.now #=> #<DateTime: 2011-06-11T21:20:44+09:00 ...>

ordinal

DateTime.ordinal([year=-4712[, yday=1[, hour=0[, minute=0[, second=0[, offset=0[, start=Date::ITALY]]]]]]]) â datetime Class Public methods Creates a date-time object denoting the given ordinal date. DateTime.ordinal(2001,34) #=> #<DateTime: 2001-02-03T00:00:00+00:00 ...> DateTime.ordinal(2001,34,4,5,6,'+7') #=> #<DateTime: 2001-02-03T04:05:06+07:00 ...> DateTime.ordinal(2001,-332,-20,-55,-54,'+7') #=> #<

parse

DateTime.parse(string='-4712-01-01T00:00:00+00:00'[, comp=true[, start=ITALY]]) â datetime Class Public methods Parses the given representation of date and time, and creates a date object. This method does not function as a validator. If the optional second argument is true and the detected year is in the range â00â to â99â, makes it full. DateTime.parse('2001-02-03T04:05:06+07:00') #=> #<DateTime: 2001-02-03T04:05:06+07:00 ...> DateTime.parse

rfc2822

DateTime.rfc2822(string='Mon, 1 Jan -4712 00:00:00 +0000'[, start=ITALY]) â datetime Class Public methods Creates a new Date object by parsing from a string according to some typical RFC 2822 formats. DateTime.rfc2822('Sat, 3 Feb 2001 04:05:06 +0700') #=> #<DateTime: 2001-02-03T04:05:06+07:00 ...>

rfc3339

DateTime.rfc3339(string='-4712-01-01T00:00:00+00:00'[, start=ITALY]) â datetime Class Public methods Creates a new Date object by parsing from a string according to some typical RFC 3339 formats. DateTime.rfc3339('2001-02-03T04:05:06+07:00') #=> #<DateTime: 2001-02-03T04:05:06+07:00 ...>

rfc822

DateTime.rfc822(string='Mon, 1 Jan -4712 00:00:00 +0000'[, start=ITALY]) â datetime Class Public methods Creates a new Date object by parsing from a string according to some typical RFC 2822 formats. DateTime.rfc2822('Sat, 3 Feb 2001 04:05:06 +0700') #=> #<DateTime: 2001-02-03T04:05:06+07:00 ...>

strptime

DateTime.strptime([string='-4712-01-01T00:00:00+00:00'[, format='%FT%T%z'[ ,start=ITALY]]]) â datetime Class Public methods Parses the given representation of date and time with the given template, and creates a date object. strptime does not support specification of flags and width unlike strftime. DateTime.strptime('2001-02-03T04:05:06+07:00', '%Y-%m-%dT%H:%M:%S%z') #=> #<DateTime: 2001-02-03T04:05:06+07:00 ...> DateTime.strptime('03-02-2001

xmlschema

DateTime.xmlschema(string='-4712-01-01T00:00:00+00:00'[, start=ITALY]) â datetime Class Public methods Creates a new Date object by parsing from a string according to some typical XML Schema formats. DateTime.xmlschema('2001-02-03T04:05:06+07:00') #=> #<DateTime: 2001-02-03T04:05:06+07:00 ...>

as_json

as_json(*) Instance Public methods Returns a hash, that will be turned into a JSON object and represent this object.

iso8601 2

dt.iso8601([n=0]) â stringdt.xmlschema([n=0]) â string Instance Public methods This method is equivalent to strftime('%FT%T'). The optional argument n is length of fractional seconds. DateTime.parse('2001-02-03T04:05:06.123456789+07:00').iso8601(9) #=> "2001-02-03T04:05:06.123456789+07:00"