Shankar Ganesh wrote:
> hi,

Hello.

> 
>    I've two dates say
> 
>   input for example.,
>    date1 = '2009-01-02';
>    date2 = '2009-01-10';
> 
>    Need to find date range array between date1 and date2.
> 
>  output for example.,
>      Array{
>      [0]=>'2009-01-02',
>      [1]=>'2009-01-03',
>      [2]=>'2009-01-04',
>      [3]=>'2009-01-05',
>      [4]=>'2009-01-06',
>      [5]=>'2009-01-07',
>      [6]=>'2009-01-08',
>      [7]=>'2009-01-09',
>      [8]=>'2009-01-10'
>      )
> Thanks in advance
> Shankar.

I'm not entirely clear on what you're looking for.  If you already have 
this data in an array, I suggest using select {}.  I.e.

data.select {|x| x >= date1 and x<= date2 }

If you're trying to fetch the data, perhaps you're looking for 
conditions.  I.e.

conditions = [ 'date_column > ? AND date_column < ?', date1, date2 ]

Hope that helps.

Cheers,
Darrik

-- 
Darrik Mazey
Developer
DMT Programming, LLC.
P.O. Box 91
Torrington, CT 06790
office: 330.983.9941
    fax: 330.983.9942
mobile: 330.808.2025
dar...@dmtprogramming.com

To obtain my public key, send an email to 
dar...@publickey.dmtprogramming.com.

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to