list. rb
1/17/2009 2:15:00 PM
[Note: parts of this message were removed to make it a legal post.]
now = Time.now
yesterday=now-1.day
tomorrow=now+1.day
is_between = true if now > yesterday and now < tomorrow
So.. you want to know if
On Sat, Jan 17, 2009 at 8:32 AM, badboy <badboy@heartofgold.co.cc> wrote:
> Cyrus Dev schrieb:
>
>> Hello all
>>
>> is there any direct comparison function in ruby or in rails for time
>>
>> I need a function which compare current time is between 2 time objects
>> or not
>>
>> ...
>>
>> Please help me
>>
>> thanks in advance
>>
> my first solution would be to put the three time objects in an Array:
> now = Time.now
> timebefore = now - 30*60*60
> timeafter = now + 30*60*60
> timearray = [now, timebefore, timeafter]
> and after that using
> timearray.sort
> to sort them. If now is between the two dates if should be on position 1
>
>
>
>