473,378 Members | 1,142 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,378 software developers and data experts.

Displaying Records between 2 dates

How to display the records between 2 dates in ruby on rails
I have 2 text boxes where i fill the 2 dates and want to display the records between these 2 dates from the database tables

Thanks in advance,
vaibhavi,,,
Apr 7 '09 #1
1 5722
improvcornartist
303 Expert 100+
You can use :conditions
Expand|Select|Wrap|Line Numbers
  1. data = ModelName.find(:all, :conditions => "date >= 'yyyy-mm-dd' and date <= 'yyyy-mm-dd'")
or you can write the SQL query, then use ModelName.find_by_sql(query).
Apr 7 '09 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: Tim Graichen | last post by:
Good morning, I have a sub-form that displays records from a table as a continuous form. The table has several hundred records, but the subform only displays five or six records. The records do...
3
by: Tim Graichen | last post by:
In subFormC, I would like to display only those records that have TrialDate and CompanyCode equal to TrialDate and CompanyCode in subFormB. Can somebody please help me? Thanks Tim
3
by: Lyn | last post by:
I need some guidance for a technique that will allow me to accomplish the following... I have a table in which each record contains a photograph. I would like to display in a form a thumbnail...
9
by: Bosconian | last post by:
I must be having a brain freeze because I can't figure out how to display dates older than 1970. I have birth dates stored in MySQL as "date" data types (exp. 1955-04-06). I'd like to display as...
4
by: jkuruvil | last post by:
I need to print a report of a bunch of records that falls between certain dates. Some records have dates and some don't. I did a UNION query to look for everything that falls between these two dates...
5
by: sejal17 | last post by:
hello everyone, I have a problem with displaying records between two dates.Below is my designing page: start date: combobox of month(smonth) & combobox of year(syear) end date :...
8
by: Dr Al | last post by:
I have a table with four date fields, some of which may not be filled in based on our data entry needs. I have a criteria set as <date()-180 which is supposed to pull dates older than 180 days ago....
5
by: sara | last post by:
Hi - I have had this problem MANY times and I just don't think I have the best solution. I am running a parameter query to retrieve records where work was completed between 2 dates. The...
8
by: rjlorenzo | last post by:
Good Day Everyone, Requesting for your expertise please, in my program the user has to enter the agent name and the from date and to date inorder to display the record. I have to use 2 conditions....
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.