Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Date - Time Parameter

Status
Not open for further replies.

DVFS

Programmer
Sep 21, 2000
44
US
Hi, I have a field that I use in a parameter for a user to select the date range. The field is a date-time field and by default allows you to pick the time in addition to the date. It defaults to the current time. Is there a way to get this to default to a time I specify (ie. 12am) but still let the user choose the dates?

Thanks In Advance
 
You should be able to create the parameter as a date type, and then in your select statement write something like:

{yourdatefield} = datetime({?date})

This will assign a time of 12:00:00 AM to the date.

-LB
 
If you are using SQL Server, this is typical. There is a way to force it all to use the Date only;

Under File/Report Options, set the "Convert Date-Time Field:" to "Date".

AND

Under File/Options, go to the Reporting tab and also set the "Convert Date-Time Field:" to "Date".

You may need to revise the existing fields, but it should all be Date format from then onwards.

If you do not do it this way, you may find that Dates are assumed to have 12:00 am (ie midnight starting that date) as the Datetime value. In date ranges, you will then need to use the tomorrow's date if you want today's data, for example.

It is helpful to show the date range used on the report in the report header or footer ("Report includes orders opened between Minimum(opendate) and Maximum(opendate)" for example. It doesn't show the range itself unless you have results for every date in the range, but should be close enough)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top