Hi,
How do i convert a string to Time ?
Is there a function like “10/10/07 14:33:05”.to_time ?
The reason I need to do this is because I want to use the Time() methods
such as asctime etc.
Cheers,
Petr
Hi,
How do i convert a string to Time ?
Is there a function like “10/10/07 14:33:05”.to_time ?
The reason I need to do this is because I want to use the Time() methods
such as asctime etc.
Cheers,
Petr
On Fri, Dec 08, 2006 at 06:13:24AM +0100, petr wrote:
How do i convert a string to Time ?
Is there a function like “10/10/07 14:33:05”.to_time ?
The reason I need to do this is because I want to use the Time() methods
such as asctime etc.
require ‘time’
=> true
Time.parse ‘10/10/07 14:33:05’
=> Wed Oct 10 14:33:05 CDT 2007
Beware though:
Time.parse ‘Ruby on Rails’
=> Thu Dec 07 23:17:56 CST 2006
Marcel Molina Jr. [email protected]
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.
Sponsor our Newsletter | Privacy Policy | Terms of Service | Remote Ruby Jobs