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!

Return Year as Date not whole number 2

Status
Not open for further replies.

epoh

IS-IT--Management
May 8, 2006
73
US
How can I return the date in the report paramater as "2006" instead of "2,006.00"

I am using this code to return the date:
Code:
[COLOR=blue]
Year({?@Beginning_Date}) [/color]

I have tried Cstr, ToText, ToNumber with no success.

 
Will thsi work?

ToText(Year({?@Beginning_Date}),"0000")
 
Year() returns the numeric value of the year from a valid Date or DateTime field.

Crystal's default formatting for numbers includes 2 decimal places and a thousands separator.

If you're simply placing the formula field on the report canvas, you could just format the field using the Format Editor (right-click the field and choose Format from the shortcut menu)


Bob Suruncle
 
FYI - If using this in a formula, the syntax is

CStr(Year({DateField}),0,"")

CStr and ToText are interchangeable.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top