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

Date conversion

Status
Not open for further replies.

twes3

Programmer
Jun 1, 2004
16
US
Hello. I converted a JDE date that I get from our database to a CR date format (01/01/2006) using the formula below:

STRINGVAR JDEDATE;
numberVar JDECENTURY;
numberVar JDEYEAR;

JDEDATE := TOTEXT({Command.CDDFYJ}, "000000");
JDECENTURY := TONUMBER(JDEDATE[1]);
JDEYEAR := TONUMBER(JDEDATE[2 TO 3]) + 1900 + (100 * JDECENTURY);

(DATE (JDEYEAR,01,01) + (TONUMBER(JDEDATE[4 TO 6]) - 1));

My question is how to convert the date that I got (01/01/2006) to a (YYYYMMDD) format?
 
Once it's a date, just right click it and select format field and select whatever format you want, or use custom for further choices.

-k
 
Or ToText({Your.Date}, "yyyyMMdd"). The advantage of ToText is that it sticks whatever machine runs the report.

[yinyang] Madawc Williams (East Anglia, UK). Using Windows XP & Crystal 10 [yinyang]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top