[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

Re: how to get 1 month in the future

Ilan Berci

1/9/2007 3:03:00 PM

shawn bright wrote:
> Hello there all, i am writing a function that will create a list of all
> the
> months between two given dates
>

require 'rubygems'
require_gem 'actionpack'
1.month.from_now

got to love actionpack.. :)

ilan



--
Posted via http://www.ruby-....

6 Answers

Giles Bowkett

1/9/2007 4:47:00 PM

0

> > require 'rubygems'
> > require_gem 'actionpack'
> > 1.month.from_now
> >
> > got to love actionpack.. :)
>
> You just have to be aware that all that does is add 30 days to today's
> date. This is not neccessarily the same as getting 1 month from today,
> which is actually a bit more complex that one would think at first glance.

Yow. That's definitely worth knowing.

Anyway, for the original poster, if you go here:

http://www.ruby-doc.org/stdlib/libdoc/...

And click on ">>" or "<<" you will find Luis' suggestion totally
works. These methods step backwards or forwards by month with Date
objects. (I have to admit, I'm kind of cuious why ActionPack doesn't
just use this to get a 1.month.from_now which really is one month from
now.)

--
Giles Bowkett
http://www.gilesg...
http://gilesbowkett.bl...
http://gilesgoatboy.bl...

lrlebron@gmail.com

1/12/2007 2:38:00 AM

0

Another option is to use chronic

require 'chronic'
puts Chronic.parse("1 month from now")


Giles Bowkett wrote:
> > > require 'rubygems'
> > > require_gem 'actionpack'
> > > 1.month.from_now
> > >
> > > got to love actionpack.. :)
> >
> > You just have to be aware that all that does is add 30 days to today's
> > date. This is not neccessarily the same as getting 1 month from today,
> > which is actually a bit more complex that one would think at first glance.
>
> Yow. That's definitely worth knowing.
>
> Anyway, for the original poster, if you go here:
>
> http://www.ruby-doc.org/stdlib/libdoc/...
>
> And click on ">>" or "<<" you will find Luis' suggestion totally
> works. These methods step backwards or forwards by month with Date
> objects. (I have to admit, I'm kind of cuious why ActionPack doesn't
> just use this to get a 1.month.from_now which really is one month from
> now.)
>
> --
> Giles Bowkett
> http://www.gilesg...
> http://gilesbowkett.bl...
> http://gilesgoatboy.bl...

Mirelle

10/20/2007 11:22:00 PM

0

Yaako Warrior from AUZ, Germany, RSA, USA, Sweden, Hong Kong, Canada,
Russia, China, Denmark, UK, .........., the slayer of fecal stained
moslems. wrote:
> Yaako Warrior from AUZ, Germany, RSA, USA, Sweden, Hong Kong, Canada,
> Russia, China, Denmark, UK, .........., the slayer of fecal stained
> moslems. wrote:
>> Yaako Warrior from AUZ, Germany, RSA, USA, Sweden, Hong Kong, Canada,
>> Russia, China, Denmark, UK, .........., the slayer of fecal stained
>> moslems. wrote:
>>> Yaako Warrior from AUZ, China, RSA, USA, Sweden, Hong Kong, Canada,
>>> Russia, China, Denmark, UK, .........., the slayer of shitskin
>>> moslems. wrote:
>>>> Yaako Warrior from AUZ, China, RSA, USA, Sweden, Hong Kong, Canada,
>>>> Russia, China, Denmark, UK, .........., the slayer of shitskin
>>>> moslems. wrote:
>>>>> Yaako Warrior from AUZ, China, RSA, USA, Sweden, Hong Kong, Canada,
>>>>> Russia, China, Denmark, UK, .........., the slayer of shitskin
>>>>> moslems. wrote:
>>>>>> Gary Rumain, the slayer of shitskin moslems, from AUZ, RSA, USA,
>>>>>> Sweden, Hong Kong, Canada, Russia, China, Denmark, UK, ..........
>>>>>> wrote:
>>>>>>> Sunny wrote:
>>>>>>>> "kangarooistan" <peramangk@gmail.com> wrote in message
>>>>>>>> news:1191640558.230729.175890@y42g2000hsy.googlegroups.com...
>>>>>>>> <The Taliban did allow Afghan girls to attend schools
>>>>>>>> <The Western media LIED
>>>>>>>>
>>>>>>>> You are a raving lunatic, as well as an arsehole.
>>>>>>>>
>>>>>>>> http://www.msnbc.msn.com/id/13392086/site...
>>>>>>>> http://www.sfgate.com/cgi-bin/article.cgi?file=/c/a/2001/11/22/MN226659.DTL&type...
>>>>>>>>
>>>>>>>> http://www.feminist.org/news/newsbyte/uswirestory.a...
>>>>>>>> http://www.sfgate.com/cgi-bin/article.cgi?file=/chronicle/archive/2003/09/09/...
>>>>>>>>
>>>>>>>>
>>>>>>>> http://www.boston.com/news/world/asia/articles/2007/01/22/taliban_says_it_will_open_its_ow...
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>
>>>>>>> He's a typical moslem !!!
>>>>>>>
>>>>>>> I - Intolerance
>>>>>>> S - Slavery
>>>>>>> L - Lies
>>>>>>> A - Anarchy
>>>>>>> M - Murder
>>>>>>>
>>>>>>> ISLAM
>>>>>>> Is a lie
>>>>>>>
>>>>>>> Mohammed was a paedophile 6th century warlord who cooked up a false
>>>>>>> religion in order to supplement brutality as a means of bringing
>>>>>>> people under subjection. It is a documented fact that most of his
>>>>>>> religious revelations occurred after a series of epileptic fits,
>>>>>>> which
>>>>>>> eventually killed him.
>>>>>>>
>>>>>>>
>>>>>>> Gary the mighty Yaako warrior.

Yaako Warrior from AUZ, China, RSA, USA, Sweden, Hong Kong, Canada, Russia, China, Denmark, UK, ....

10/21/2007 11:26:00 PM

0

Yaako Warrior from AUZ, Germany, RSA, USA, Sweden, Hong Kong, Canada,
Russia, China, Denmark, UK, .........., the slayer of fecal stained
moslems. wrote:
> Yaako Warrior from AUZ, Germany, RSA, USA, Sweden, Hong Kong, Canada,
> Russia, China, Denmark, UK, .........., the slayer of fecal stained
> moslems. wrote:
>> Yaako Warrior from AUZ, Germany, RSA, USA, Sweden, Hong Kong, Canada,
>> Russia, China, Denmark, UK, .........., the slayer of fecal stained
>> moslems. wrote:
>>> Yaako Warrior from AUZ, Germany, RSA, USA, Sweden, Hong Kong, Canada,
>>> Russia, China, Denmark, UK, .........., the slayer of fecal stained
>>> moslems. wrote:
>>>> Yaako Warrior from AUZ, Germany, RSA, USA, Sweden, Hong Kong,
>>>> Canada, Russia, China, Denmark, UK, .........., the slayer of fecal
>>>> stained moslems. wrote:
>>>>> Yaako Warrior from AUZ, China, RSA, USA, Sweden, Hong Kong, Canada,
>>>>> Russia, China, Denmark, UK, .........., the slayer of shitskin
>>>>> moslems. wrote:
>>>>>> Yaako Warrior from AUZ, China, RSA, USA, Sweden, Hong Kong,
>>>>>> Canada, Russia, China, Denmark, UK, .........., the slayer of
>>>>>> shitskin moslems. wrote:
>>>>>>> Yaako Warrior from AUZ, China, RSA, USA, Sweden, Hong Kong,
>>>>>>> Canada, Russia, China, Denmark, UK, .........., the slayer of
>>>>>>> shitskin moslems. wrote:
>>>>>>>> Gary Rumain, the slayer of shitskin moslems, from AUZ, RSA, USA,
>>>>>>>> Sweden, Hong Kong, Canada, Russia, China, Denmark, UK,
>>>>>>>> .......... wrote:
>>>>>>>>> Sunny wrote:
>>>>>>>>>> "kangarooistan" <peramangk@gmail.com> wrote in message
>>>>>>>>>> news:1191640558.230729.175890@y42g2000hsy.googlegroups.com...
>>>>>>>>>> <The Taliban did allow Afghan girls to attend schools
>>>>>>>>>> <The Western media LIED
>>>>>>>>>>
>>>>>>>>>> You are a raving lunatic, as well as an arsehole.
>>>>>>>>>>
>>>>>>>>>> http://www.msnbc.msn.com/id/13392086/site...
>>>>>>>>>> http://www.sfgate.com/cgi-bin/article.cgi?file=/c/a/2001/11/22/MN226659.DTL&type...
>>>>>>>>>>
>>>>>>>>>> http://www.feminist.org/news/newsbyte/uswirestory.a...
>>>>>>>>>> http://www.sfgate.com/cgi-bin/article.cgi?file=/chronicle/archive/2003/09/09/...
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>> http://www.boston.com/news/world/asia/articles/2007/01/22/taliban_says_it_will_open_its_ow...
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>
>>>>>>>>> He's a typical moslem !!!
>>>>>>>>>
>>>>>>>>> I - Intolerance
>>>>>>>>> S - Slavery
>>>>>>>>> L - Lies
>>>>>>>>> A - Anarchy
>>>>>>>>> M - Murder
>>>>>>>>>
>>>>>>>>> ISLAM
>>>>>>>>> Is a lie
>>>>>>>>>
>>>>>>>>> Mohammed was a paedophile 6th century warlord who cooked up a
>>>>>>>>> false
>>>>>>>>> religion in order to supplement brutality as a means of bringing
>>>>>>>>> people under subjection. It is a documented fact that most of his
>>>>>>>>> religious revelations occurred after a series of epileptic
>>>>>>>>> fits, which
>>>>>>>>> eventually killed him.
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> Gary the mighty Yaako warrior.
>
> HOW TO BECOME A SHITSKIN MOSLEM - this is how: fuck goats, molest
> children, wear a beekeepers outfit all the time, never shower or bath,
> beat your wives, learn terrorist activities at a maddrassa, wipe your
> ass with stones, sell the donkey you fucked to a nearby village, marry a
> nine year-old , send your child off to an indoctrination camp, practice
> thighing with little kids, ............ Practice all those and you too
> could become a prophet !!

kangarooistan

10/21/2007 11:26:00 PM

0

Yaako Warrior from AUZ, Germany, RSA, USA, Sweden, Hong Kong, Canada,
Russia, China, Denmark, UK, .........., the slayer of fecal stained
moslems. wrote:
> Yaako Warrior from AUZ, Germany, RSA, USA, Sweden, Hong Kong, Canada,
> Russia, China, Denmark, UK, .........., the slayer of fecal stained
> moslems. wrote:
>> Yaako Warrior from AUZ, Germany, RSA, USA, Sweden, Hong Kong, Canada,
>> Russia, China, Denmark, UK, .........., the slayer of fecal stained
>> moslems. wrote:
>>> Yaako Warrior from AUZ, Germany, RSA, USA, Sweden, Hong Kong, Canada,
>>> Russia, China, Denmark, UK, .........., the slayer of fecal stained
>>> moslems. wrote:
>>>> Yaako Warrior from AUZ, Germany, RSA, USA, Sweden, Hong Kong,
>>>> Canada, Russia, China, Denmark, UK, .........., the slayer of fecal
>>>> stained moslems. wrote:
>>>>> Yaako Warrior from AUZ, China, RSA, USA, Sweden, Hong Kong, Canada,
>>>>> Russia, China, Denmark, UK, .........., the slayer of shitskin
>>>>> moslems. wrote:
>>>>>> Yaako Warrior from AUZ, China, RSA, USA, Sweden, Hong Kong,
>>>>>> Canada, Russia, China, Denmark, UK, .........., the slayer of
>>>>>> shitskin moslems. wrote:
>>>>>>> Yaako Warrior from AUZ, China, RSA, USA, Sweden, Hong Kong,
>>>>>>> Canada, Russia, China, Denmark, UK, .........., the slayer of
>>>>>>> shitskin moslems. wrote:
>>>>>>>> Gary Rumain, the slayer of shitskin moslems, from AUZ, RSA, USA,
>>>>>>>> Sweden, Hong Kong, Canada, Russia, China, Denmark, UK,
>>>>>>>> .......... wrote:
>>>>>>>>> Sunny wrote:
>>>>>>>>>> "kangarooistan" <peramangk@gmail.com> wrote in message
>>>>>>>>>> news:1191640558.230729.175890@y42g2000hsy.googlegroups.com...
>>>>>>>>>> <The Taliban did allow Afghan girls to attend schools
>>>>>>>>>> <The Western media LIED
>>>>>>>>>>
>>>>>>>>>> You are a raving lunatic, as well as an arsehole.
>>>>>>>>>>
>>>>>>>>>> http://www.msnbc.msn.com/id/13392086/site...
>>>>>>>>>> http://www.sfgate.com/cgi-bin/article.cgi?file=/c/a/2001/11/22/MN226659.DTL&type...
>>>>>>>>>>
>>>>>>>>>> http://www.feminist.org/news/newsbyte/uswirestory.a...
>>>>>>>>>> http://www.sfgate.com/cgi-bin/article.cgi?file=/chronicle/archive/2003/09/09/...
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>> http://www.boston.com/news/world/asia/articles/2007/01/22/taliban_says_it_will_open_its_ow...
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>
>>>>>>>>> He's a typical moslem !!!
>>>>>>>>>
>>>>>>>>> I - Intolerance
>>>>>>>>> S - Slavery
>>>>>>>>> L - Lies
>>>>>>>>> A - Anarchy
>>>>>>>>> M - Murder
>>>>>>>>>
>>>>>>>>> ISLAM
>>>>>>>>> Is a lie
>>>>>>>>>
>>>>>>>>> Mohammed was a paedophile 6th century warlord who cooked up a
>>>>>>>>> false
>>>>>>>>> religion in order to supplement brutality as a means of bringing
>>>>>>>>> people under subjection. It is a documented fact that most of his
>>>>>>>>> religious revelations occurred after a series of epileptic
>>>>>>>>> fits, which
>>>>>>>>> eventually killed him.
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> Gary the mighty Yaako warrior.
>
> HOW TO BECOME A SHITSKIN MOSLEM - this is how: fuck goats, molest
> children, wear a beekeepers outfit all the time, never shower or bath,
> beat your wives, learn terrorist activities at a maddrassa, wipe your
> ass with stones, sell the donkey you fucked to a nearby village, marry a
> nine year-old , send your child off to an indoctrination camp, practice
> thighing with little kids, ............ Practice all those and you too
> could become a prophet !!

ElParedon

10/23/2007 11:38:00 PM

0

Yaako Warrior from AUZ, Germany, RSA, USA, Sweden, Hong Kong, Canada,
Russia, China, Denmark, UK, .........., the slayer of fecal stained
moslems. wrote:
> Yaako Warrior from AUZ, Germany, RSA, USA, Sweden, Hong Kong, Canada,
> Russia, China, Denmark, UK, .........., the slayer of fecal stained
> moslems. wrote:
>> Yaako Warrior from AUZ, Germany, RSA, USA, Sweden, Hong Kong, Canada,
>> Russia, China, Denmark, UK, .........., the slayer of fecal stained
>> moslems. wrote:
>>> Yaako Warrior from AUZ, Germany, RSA, USA, Sweden, Hong Kong, Canada,
>>> Russia, China, Denmark, UK, .........., the slayer of fecal stained
>>> moslems. wrote:
>>>> Yaako Warrior from AUZ, Germany, RSA, USA, Sweden, Hong Kong,
>>>> Canada, Russia, China, Denmark, UK, .........., the slayer of fecal
>>>> stained moslems. wrote:
>>>>> Yaako Warrior from AUZ, China, RSA, USA, Sweden, Hong Kong, Canada,
>>>>> Russia, China, Denmark, UK, .........., the slayer of shitskin
>>>>> moslems. wrote:
>>>>>> Yaako Warrior from AUZ, China, RSA, USA, Sweden, Hong Kong,
>>>>>> Canada, Russia, China, Denmark, UK, .........., the slayer of
>>>>>> shitskin moslems. wrote:
>>>>>>> Yaako Warrior from AUZ, China, RSA, USA, Sweden, Hong Kong,
>>>>>>> Canada, Russia, China, Denmark, UK, .........., the slayer of
>>>>>>> shitskin moslems. wrote:
>>>>>>>> Gary Rumain, the slayer of shitskin moslems, from AUZ, RSA, USA,
>>>>>>>> Sweden, Hong Kong, Canada, Russia, China, Denmark, UK,
>>>>>>>> .......... wrote:
>>>>>>>>> Sunny wrote:
>>>>>>>>>> "kangarooistan" <peramangk@gmail.com> wrote in message
>>>>>>>>>> news:1191640558.230729.175890@y42g2000hsy.googlegroups.com...
>>>>>>>>>> <The Taliban did allow Afghan girls to attend schools
>>>>>>>>>> <The Western media LIED
>>>>>>>>>>
>>>>>>>>>> You are a raving lunatic, as well as an arsehole.
>>>>>>>>>>
>>>>>>>>>> http://www.msnbc.msn.com/id/13392086/site...
>>>>>>>>>> http://www.sfgate.com/cgi-bin/article.cgi?file=/c/a/2001/11/22/MN226659.DTL&type...
>>>>>>>>>>
>>>>>>>>>> http://www.feminist.org/news/newsbyte/uswirestory.a...
>>>>>>>>>> http://www.sfgate.com/cgi-bin/article.cgi?file=/chronicle/archive/2003/09/09/...
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>> http://www.boston.com/news/world/asia/articles/2007/01/22/taliban_says_it_will_open_its_ow...
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>
>>>>>>>>> He's a typical moslem !!!
>>>>>>>>>
>>>>>>>>> I - Intolerance
>>>>>>>>> S - Slavery
>>>>>>>>> L - Lies
>>>>>>>>> A - Anarchy
>>>>>>>>> M - Murder
>>>>>>>>>
>>>>>>>>> ISLAM
>>>>>>>>> Is a lie
>>>>>>>>>
>>>>>>>>> Mohammed was a paedophile 6th century warlord who cooked up a
>>>>>>>>> false
>>>>>>>>> religion in order to supplement brutality as a means of bringing
>>>>>>>>> people under subjection. It is a documented fact that most of his
>>>>>>>>> religious revelations occurred after a series of epileptic
>>>>>>>>> fits, which
>>>>>>>>> eventually killed him.
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> Gary the mighty Yaako warrior.
>
> HOW TO BECOME A SHITSKIN MOSLEM - this is how: fuck goats, molest
> children, wear a beekeepers outfit all the time, never shower or bath,
> beat your wives, learn terrorist activities at a maddrassa, wipe your
> ass with stones, sell the donkey you fucked to a nearby village, marry a
> nine year-old , send your child off to an indoctrination camp, practice
> thighing with little kids, ............ Practice all those and you too
> could become a prophet !!