Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.ruby > #2445

Re: convert string to datetime

From Brian Candler <b.candler@pobox.com>
Newsgroups comp.lang.ruby
Subject Re: convert string to datetime
Date 2011-04-07 05:55 -0500
Organization Service de news de lacave.net
Message-ID <6661754cd57dcfdfe89fc5a6aaddb1f9@ruby-forum.com> (permalink)
References <0118058fc84316aaefb7bbfddd395421@ruby-forum.com> <BANLkTik29wYYDpO32O7QCuA0npRXipfDAA@mail.gmail.com>

Show all headers | View raw


"Jesús Gabriel y Galán" <jgabrielygalan@gmail.com> wrote in post 
#991424:
> DateTime#parse:

Or DateTime.strptime, if you want to be explicit about the format.

>> DateTime.strptime("20110309","%Y%m%d")
=> #<DateTime: 4911259/2,0,2299161>

-- 
Posted via http://www.ruby-forum.com/.

Back to comp.lang.ruby | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

convert string to datetime Fan Jin <jeff_yq@yahoo.com.au> - 2011-04-07 05:12 -0500
  Re: convert string to datetime Jesús Gabriel y Galán <jgabrielygalan@gmail.com> - 2011-04-07 05:22 -0500
    Re: convert string to datetime Brian Candler <b.candler@pobox.com> - 2011-04-07 05:55 -0500
      Re: convert string to datetime Fan Jin <jeff_yq@yahoo.com.au> - 2011-04-07 20:55 -0500

csiph-web