Name
ParseDate — Date representation parser module
Synopsis
The ParseDate
module parses strings that represent
calendar dates in various formats.
Required Library
require ‘parsedate’
Module Function
parsedate(
str
[,
cyear
=false])
Parses a date and/or time expression within
str
and returns the parsed elements (year, month, day, hour, minute, second, time zone, and day of the week) as an array. Sunday is represented as 0 in the day-of-the-week element.nil
is returned for elements that can’t be parsed or have no corresponding string representation. Ifcyear
istrue
, years with a value of 68 or less are interpreted as being in the 2000s and years ranging from 69 to 99 are interpreted as being in the 1900s. In summary, beware of the Y2K69 problem!
Get Ruby in a Nutshell now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.