It was my understanding that when entering dates using the calander, auto enter or DateTime Stamp, the backend stores the complete date and time. When using the date property on a form to format a date, it just formats the display of value , and the actual value in the backend (SQL 2000) is the complete Date a Time format.
I have a method that searchs a field for a date range, if I format the values as MM-dd-yyyy hh:mm:ss in the properties and search it works fine, if I change the format to something else such as hh:mm:ss a and perform the search, I do not get results.
Here is a piece of my search method:
//Format date for Search
if (globals.Date1)
{
var d1 = globals.Date1
d1.setHours(00)
d1.setMinutes(00)
d1.setSeconds(00)
var df1 = utils.dateFormat(d1, ‘MM-dd-yyyy hh:mm:ss’)
}
if(globals.Date2)
{
var d2 = globals.Date2
d2.setHours(00)
d2.setMinutes(00)
d2.setSeconds(00)
var df2 = utils.dateFormat(d2, ‘MM-dd-yyyy hh:mm:ss’)
}
//validate date fields
if (globals.Date1 == null && globals.Date2 || globals.Date2 == null && globals.Date1)
{
plugins.dialogs.showInfoDialog(‘Warning’, ‘You must enter a start and end date’,‘OK’);
return
}
controller.find()
if (globals.Date1 && globals.Date2)
{
createdrecvd_datetime = df1+ ‘…’ + df2 + ‘|MM-dd-yyyy hh:mm:ss’;
}
else
{
createdrecvd_datetime = null;
}
controller.search()
application.closeFormDialog();
forms.CSServiceOrderSearchResults.controller.show();
When I debug I see that the date variables are formatted correctly
d1 Thu Dec 15 00:00:00 EST 2005
df1 12-15-2005 12:00:00
So why does changing the format in the properties window on a form, effect the search when I am creating variables in my method that should format the date regardless of the format in the properties window.
All I want to do is search the date field, excluding the time portion for a range, I read a post saying to use the # symbol, but could not get it to work on a manual search.
Any clarification would be appreciated
Thanks,
Erich