How do you assign time to a variable.
ie:
9:30 AM
party = cccc.to_time ?
how about military time?
How do you assign time to a variable.
ie:
9:30 AM
party = cccc.to_time ?
how about military time?
rashantha wrote:
How do you assign time to a variable.
Google and/or use ri on your command line for Time#now
ie:
9:30 AM
party = cccc.to_time ?
party = Time.parse(‘9:30 am’). But I’m not sure what it will do about
the date.
In Rails, 9.hours + 30.minutes might also work, to get the seconds from
midnite.
how about military time?
Time.now.strftime(’%H:%M’).
Google strftime to learn the correct codes to put in there.
–
Phlip
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