query on dates

Unfurtunately, my problem is still not resolved.
The errormessage is solved, but the selection is still not working.

2 calender fields on the form

I want to select from first date 00:00:00 till second date 23:59:59

Whatever I try, Servoy is changing the dates.
I tried to use new Date()
I tried to build a string with second date 23:59:59

So I want to select 01/01/1992 00:00:00 till 21/10/2009 23:59:59

Look at the image:

[attachment=0]Capture.JPG[/attachment]

When I do a getDate() on the 21/10/2009 field, I get 20 as result. I think that has something to do with summertime.

How can I get this select on de following periode:

01/01/1992 00:00:00 till 21/10/2009 23:59:59

I finally got a working situation:

function dateSelection()
{
	var _date_from  = arguments[0]
	var _date_till = arguments[1]
	var _string
	var  _time_string 
		
	if (! _date_from)
	{
		var _datetime_from = new Date(1900, 0, 1, 0, 0, 0)		
		_time_string = _datetime_from.toLocaleDateString() + ' 00:00:00'
	}
	
	else
	{
		_time_string = _date_from.toLocaleDateString() + ' 00:00:00'	
	}	
	
	_string = _time_string;
	
	if (! _date_till)
	{
		var _datetime_till = new Date(2099, 11, 31, 23, 59, 59)	
		_time_string = _datetime_till.toLocaleDateString() + ' 23:59:59'		
	}
	else
	{	
		_time_string = _date_till.toLocaleDateString() + ' 23:59:59'
	}		
	
	_string += '...' + _time_string
	_string += ' |dd MMMMM yyyy HH:mm:ss'
		
	return _string
}

Is this the correct way?

The result is:

1 januari 1992 00:00:00…21 oktober 2009 23:59:59 |dd MMMMM yyyy HH:mm:ss

And this can be used in the findmodes

Martin

ROCLASI:
Hi Martin,

I somehow recall that when you are using the formatting criteria (|dd/MM/yyyy etc.) you need to prefix the whole text with a hash.
Like so:

if (globals.search_date_01 && globals.search_date_02)

invoice_date = “#” + utils.dateFormat(globals.search_date_01, ‘dd/MM/yyyy HH:mm:ss’) + ‘…’ + utils.dateFormat(globals.search_date_02, ‘dd/MM/yyyy HH:mm:ss’) + ‘|dd/MM/yyyy HH:mm:ss’




Hope this helps.

Hi Robert,

I tried with the hash, but that doesn’t work.

Martin