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!

Datediff error

Status
Not open for further replies.

lawre016

Technical User
Apr 9, 2002
13
US
What am I missing?
This formula
Datediff("d",({@Routed Date}),NumberToDate(ToNumber({DH_DOCUMENT.DH_ISSUED_DATE}))) + 1

Gives me this error:
"A number, currency amount, date - time string expected here". It is just before the 'NumberToDate'

FYI @routed date = Date (val({DV_DOC_APPROVAL.DV_READY_DATE}[1 TO 4]),val({DV_DOC_APPROVAL.DV_READY_DATE}[5 to 6]),
val({DV_DOC_APPROVAL.DV_READY_DATE}[7 to 8]))
 
DateDiff wants three arguments,

The first specifies what the difference should be reported as (and you have chosen 'd'ays),
the 2nd and 3rd should the the two dates to compare.

Your 2nd looks ok but the 3rd looks odd.

Are you trying to add one day to {DH_DOCUMENT.DH_ISSUED_DATE}? If so, try

Datediff ("d",{@Routed Date}, {DH_DOCUMENT.DH_ISSUED_DATE})+1

Steve Phillips, Crystal Consultant
 
Hi lawre016,

I think the 3rd date value is causing the problem. Please explain the parts of the following formula:

NumberToDate(ToNumber({DH_DOCUMENT.DH_ISSUED_DATE}))
 
DH_DOCUMENT.DH_ISSUED_DATE is a string field. I am converting that to a number (ToNumber), then converting that to a date.
 
NumbertoDate() takes an 8 digit integer in a YYYYMMDD format and converts it to a real date. Does your data fit this format?
Software Sales, Training and Support for Macola, Crystal Reports and Goldmine
dgilsdorf@mchsi.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top