rbnaz
asked on
Formula to format date from using "/" to "-".
In Crystal Reports, I need a formula to change CurrentDate from mm/dd/yyyy to mm-dd-yy without changing Options/Fields/Date.
ASKER
That gives me "mm-dd-yy" in text format.
What are you trying to do?
YOu should be able to simply set a custom format for the field
Right click the field on the report
Click FORMAT FIELD
Click the DATE tab
Select the format if it is shown or click CUSTOMIZE
Set the format as desired
mlmcc
YOu should be able to simply set a custom format for the field
Right click the field on the report
Click FORMAT FIELD
Click the DATE tab
Select the format if it is shown or click CUSTOMIZE
Set the format as desired
mlmcc
ASKER
I am putting the field into a formula which is used to create a barcode. The following works: Replace(totext(currentdate ), "/", "-"), though it uses "yyyy" instead of "yy".
Don't you have to specify a format, e.g. mm/dd/yyyy, when using totext?
ToText({table.datefield},"MM/dd/yyyy")
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Making the year from four digits to two digits makes the barcode smaller. Thanks.
totext(CurrentDate, "mm-dd-yy")