When formatting a text field in a Crystal Report formula field there are two options. To get a standard date format, such as "01/01/2013" or "Tuesday, January 01, 2013", you can use the date format functions FormatShortDate and FormatLongDate. The basic formulas are FormatShortDate({Field Name}) and FormatLongDate({FieldName}).
If you need a more complex date format, you can use the ToText function that is built into Crystal Reports.
The basic formula is: ToText({fieldname}, "DateFormat")
To build a date format, use "M" for month, "d" for day and "y" for year. These values are case sensitive and must be surrounded by double quotations. They can be used in combination to build a large number of formats.
See examples below for a starting place:
"MMMM d, yyyy" = January 1, 2013
"MMM dd yy" = Jan 01 13
"MM/dd/yy" = 01/01/13
"dddd M-dd-yyyy" = Tuesday 1-01-2013
"ddd MM/d/yyyy" = Tue 01/1/2013
Comments
0 comments
Please sign in to leave a comment.