Hi,
In one of my application i have to create a date obj like 2009-02-05
23:26:35
but for this i have following input which is integer.
form_day = 05, from_month = 02 from_year= 2009 and from_time=12:00:00
Please suggest a best solution for it?
Hi,
In one of my application i have to create a date obj like 2009-02-05
23:26:35
but for this i have following input which is integer.
form_day = 05, from_month = 02 from_year= 2009 and from_time=12:00:00
Please suggest a best solution for it?
Look up the date class in the prag prog’s book. It explains how to
create dates. Date.new(2008,12,30) for example.
Blog: http://random8.zenunit.com/
Learn rails: http://sensei.zenunit.com/
On 06/02/2009, at 8:42 PM, Sunny B.
<[email protected]
try it like this:
date = DateTime.civil(y=from_year, m=from_month, d=from_month,
min=from_time.min, s=from_time.sec, of=0)
here is the according ruby-api:
http://www.ruby-doc.org/core/classes/DateTime.html
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