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 wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Date Format Change 2

Status
Not open for further replies.

kbfnet

Programmer
Nov 16, 2004
28
US
Hello,

How can I change a date format from 04/18/2005 to 04/18/05 so that the year is only two digits and not four? I am also trying to make sure that the end of date is always a Wednesday. By using my formulas below I get an extra zero in the date range if the date already has two digits. For example, 12/31/2004 becomes 012/031/00.

I have tried the following:

@MM Formula:
if len (totext(Month ({dailysummaryeod.EODDATE})))=2
then totext(Month ({dailysummaryeod.EODDATE}))
else "0" + totext(Month ({dailysummaryeod.EODDATE}))

@DD Formula:
if len(totext(Day({dailysummaryeod.EODDATE})))=2
then totext(Day({dailysummaryeod.EODDATE}))
else "0" + totext(Day({dailysummaryeod.EODDATE}))

@YY:
if len(totext(Year({dailysummaryeod.EODDATE})))=2
then totext(Year({dailysummaryeod.EODDATE}))
else "0" + totext(Year({dailysummaryeod.EODDATE}))

@MMDDYY:This is the formula that I actually put in the report.

left({@MM},(len({@MM})-3) )


+

left({@DD},(len({@DD})-3) )

+

mid({@YY},4, 2 )


Thank you,
Kbfnet
 
Place the date on your report canvas and right click on it->format field->date->customize->year->99. You can also adjust month to: 03, and day to 01, if not already set this way. No need for a formula.

-LB
 
You can also use ToText - this has advantages, like being able to say "No Date" for a null. E.g.
Code:
if isnull({your date}) then "No Date"
else Totext({your date}, DD/MM/YY)
Other options include day-names and month-names, short and long.

[yinyang] Madawc Williams (East Anglia, UK) [yinyang]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top