Flowdock
strptime(p1 = v1, p2 = v2, p3 = v3) public

Parses the given representation of date and time with the given template, and creates a date object.

For example:

Date.strptime('2001-02-03', '%Y-%m-%d')   #=> #<Date: 2001-02-03 ...>
Date.strptime('03-02-2001', '%d-%m-%Y')   #=> #<Date: 2001-02-03 ...>
Date.strptime('2001-034', '%Y-%j')        #=> #<Date: 2001-02-03 ...>
Date.strptime('2001-W05-6', '%G-W%V-%u')  #=> #<Date: 2001-02-03 ...>
Date.strptime('2001 04 6', '%Y %U %w')    #=> #<Date: 2001-02-03 ...>
Date.strptime('2001 05 6', '%Y %W %u')    #=> #<Date: 2001-02-03 ...>
Date.strptime('sat3feb01', '%a%d%b%y')    #=> #<Date: 2001-02-03 ...>

See also strptime(3) and strftime.

Show source
Register or log in to add new notes.
June 28, 2011 - (v1_9_2_180)
1 thank