Asp Forum
Home
|
Login
|
Register
|
Search
Forums
>
comp.lang.ruby
x days add to date format
aidy
8/10/2008 3:53:00 PM
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
1 Answer
Eric I.
8/10/2008 4:33:00 PM
0
On Aug 10, 11:52 am, aidy <aidy.le...@googlemail.com> 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://Lea...
.
Servizio di avviso nuovi messaggi
Ricevi direttamente nella tua mail i nuovi messaggi per
x days add to date format
Inserendo la tua e-mail nella casella sotto, riceverai un avviso tramite posta elettronica ogni volta che il motore di ricerca troverà un nuovo messaggio per te
Il servizio è completamente GRATUITO!
x
Login to ForumsZone
Login with Google
Login with E-Mail & Password