JamesJMcDonnell
asked on
Formula to format date string field in "DD/MM/YYY" to match date range parameter in Crystal Reports
I have a date field held in a string in "DD/MM/YYY" format and want to use it in record selection criteria to match a date range parameter. I've tried converting it to a formula using:
Right ({Transit Analysis PO Details.CompletedDate},4 ) + '/' + Left(Right ({Transit Analysis PO Details.CompletedDate},4), 2) + '/' + Left ({Transit Analysis PO Details.CompletedDate},2 )
but this does not work. Hoshould I change the formula to get it to work or do I need to take a different approach?
Right ({Transit Analysis PO Details.CompletedDate},4 ) + '/' + Left(Right ({Transit Analysis PO Details.CompletedDate},4),
but this does not work. Hoshould I change the formula to get it to work or do I need to take a different approach?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks BDreed35 your code works. I have a connected problem now. I want to display the date range on the report and using a normal formula for this,
e.g. minimum({?DateRange}) & " to " & maximum({?DateRange}) the date comes out in MM/DD/YYYY format. This is not so easy to reaarange as leading zeroes are dropped as in e.g. 6/1/2006 to 6/30/2006. How might this conversion be done?
e.g. minimum({?DateRange}) & " to " & maximum({?DateRange}) the date comes out in MM/DD/YYYY format. This is not so easy to reaarange as leading zeroes are dropped as in e.g. 6/1/2006 to 6/30/2006. How might this conversion be done?
Write it this way:
totext(minimum({?DateRange }),"MM/DD/ YYYY") & " to " & totext(maximum({?DateRange }),"MM/DD/ YYYY")
totext(minimum({?DateRange
ASKER
It turned out that the format of the date range was affected by settings on the server I was running the report on. Applying your formula instead of the standard one then caused it to come out as 06/DD/YYYY to 06/DD/YYYY !?
Thanks for your help
Thanks for your help
ASKER