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

date number compare

Status
Not open for further replies.

smeyer

IS-IT--Management
Nov 15, 2002
52
US
Crystal reads the date field from my pervasive DB as 20021127 but I need to select on current date is there a way to convert this to a date or convert currentDate to string or number for a comparison?
 
Sure, you can do either.

Your best bet is to place something in the record selection akin to:

{MyTable.MyDateValue} = val(totext(year(currentdate),0000,"")+totext(month(currentdate),00,"")+totext(day(currentdate),00,""))

This assumes that it's a value and not text, if it's a text field, eliminate the val()

-k

Happy T-Day kai@informeddatadecisions.com
 
this is similar to what I'm looking at - is there anyway to do this is the SQL?
 
you can download the NumberToDate() function from the crystal decisions website, or I can email it to you. NumberToDate() converts an 8 digit integer in a YYYYMMDD format to a real date. Macola and ACCPAC are two of the main packages that use this type of date, although thankfully the new version of Macola is going to use real dates.

NumberToDate({YourNumericDateField}) in CurrentDate

Should return the records you are looking for.

Let me know if you have any questions. Software Sales, Training and Support for Macola, Crystal Reports and Goldmine
dgilsdorf@mchsi.com
 
hey I did try to download the function from the Crystal website and I tried installing it but I found the readme file not that easy to figure out. anyways, it didn't work - if you could email it to me that would be great - mwhalen@hotmail.com

Thanks!
 
I'm not sure what the pervasive SQL equivalent would be, try using substring() in a SQL Expression.

Dates formatted as strings are always problematic, if you can generate a View which converts it to a date, then you can just point to the View in the future.

-k kai@informeddatadecisions.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top