Hi,
I apologize cause i know this has been asked many times but i just cant solve it.
Im trying to use a find() on a date range, i clearly want all records whose date is between 2 other dates.
heres my code
databaseManager.setAutoSave(true)
forms.pedidos.controller.find()
var Searchdate = new Date()
Searchdate = utils.dateFormat(globals.firstDate,'yyyy-MM-dd')+...+utils.dateFormat(globals.lastDate,'yyyy-MM-dd')
forms.pedidos.date = Searchdate +'| yyyy-MM-dd';
var found = forms.pedidos.controller.search()
databaseManager.setAutoSave(false)
And well its finding every record on the table.
Any ideas??
if ( forms.pedidos.controller.find() ) {
// 3 periods should be between quotes.
var Searchdate = utils.dateFormat(globals.firstDate,'yyyy-MM-dd')+"..."+utils.dateFormat(globals.lastDate,'yyyy-MM-dd')
// If I remember correctly when using a mask in search you need to use the hash sign at the beginning
forms.pedidos.date = "#" + Searchdate +'| yyyy-MM-dd';
var found = forms.pedidos.controller.search()
}
The only thing that comes to my mind is that perhaps the format that the DB stores the date value is not the same im using to compare.
What i dont get is that if i do a query on the DB it returns values with yyyy-MM-dd format but if i do an application.output of the date field it returns somenthing like Fri 23 Dec 00:00:0000 GMT 2009 (or something like that).
And what annoys me is that if i search for an exact date (not a range) it works perfectly fine.
nromeou:
if i do an application.output of the date field it returns somenthing like Fri 23 Dec 00:00:0000 GMT 2009 (or something like that).
When you do that you are actually looking at a Java Date object…so yes the formatting is different.
But the locale/formatting shouldn’t make a difference. Let me do some testing.