Hi,
Can anyone tell me how I can add 10 days to this date format please?
Time.now.localtime.strftime("%d-%b-%Y")
Thanks
Aidy
Hi,
Can anyone tell me how I can add 10 days to this date format please?
Time.now.localtime.strftime("%d-%b-%Y")
Thanks
Aidy
On Aug 10, 11:52 am, aidy [email protected] wrote:
Can anyone tell me how I can add 10 days to this date format please?
Time.now.localtime.strftime(“%d-%b-%Y”)
SECONDS_PER_DAY = 60 * 60 * 24
(Time.now + 10*SECONDS_PER_DAY).localtime.strftime(“%d-%b-%Y”)
Ideally you want to do the date/time manipulations before converting
to a String. Otherwise you have to parse the string, do the date
manipulations, and convert back to a String.
Eric
====
Rails and Ruby training available at http://LearnRuby.com .
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