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 Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Format a Date Parameter

Status
Not open for further replies.

crywrite

Technical User
Feb 7, 2002
34
US
Using a parameter to enter a date range. The default crystal format for a date is "20020416". The database format I'm pulling from is "02-Apr-16". We are not getting correct data pulled into the report. Is there a way to reformat the date in the parameter to match our database format.
 
You need to create a new parameter. When creating this parameter first look at the date field you are wanting to filter information based upon. Determine if this field is Date or Date/Time, choose which ever is applicable in the value type tab. Next click on default values. Here you will actually browse to the field your going to filter and set this as your default data type. Place your paramter in your report and try filter based on this.
 
try this. it works for me

cdate("2002,4,16")

 
I do not believe that 20020416 is a date format in Crystal Reports, nor is it a default value. Parameters in Crystal do not have default values unless you give them one. Double check your parameter and make sure the data type is Date.

There are a number of software packages out there that store the dates as 8 digit integers, Macola being the one I am most familiar with.

To deal with this, there is a NumberToDate() function available for download at the Crystal Decisions website. NumberToDate(20020416) will return a date of 04/16/2002. So to use this in your record selection formula,

NumberToDate({datefield}) in {?DateRangeParameter}

Should work fine. Is this what you need? Software Support for Macola, Crystal Reports and Goldmine
dgilsdorf@mchsi.com
 
Thank you for your help. It is greatly appreciated.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top