In model i have (as part of find statement)
sd.created_on <=> (sd_ticket_start_date…sd_ticket_end_date)
(Here i am using ez_where plugin So <=> means BETWEEN)
And for example I am passing dates from view like
<%= text_field “sd_ticket”,
I know created_on field is saved in the format ‘2008-07-30
So my problem is if I pass both dates(start and end date) equal say
07/31/2008 from view I dont get the records which are created on
So in model how can I format the value in sd_ticket_start_date (
07/31/2008 ) to the format ‘2008-07-30 18:22:11.30577’ like that.
Thanks in advance
the database is including the time in the search.
so make sure, that either enddate has a time of 23:59:59
or is the next day at 0:0:0
I looked in log file The query formed is
SELECT * FROM service_desk_tickets WHERE
((service_desk_tickets.created_on BETWEEN ‘07/31/2008’ AND
Here if I create two ticket in this date(07/31/2008) at 11.30 AM and
11.45 PM for example I dont get it on the search .And to get todays
record I have to enter startdate as 07/31/2008 and end date 08/01/2008
The possible solution for this would be I suppose to compare start and
end before passing it to the sql query.
you would be comparing it for whether start-date is less than end date
or not. Likewise, have a similarity comparision and if it equals pass
it on to the query for that respective date alone.