Page 1 of 1

Date Format

Posted: Tue Jul 13, 2004 12:45 am
by badri
Hi,

Ereplace( Trim(Oconv(@DATE, "D YMD")), " ", "") returns 3152004 instead of 03152004 where 03 is the month and 15 is the date. Correct me if any format is missed out.

The data should be in the below format

mmddyyyy

Posted: Tue Jul 13, 2004 12:58 am
by rasi
Hi Badri

You had missed the syntax.

Try this Ereplace( Trim(Oconv(@DATE, "D YMD[4,2,2]")), " ", "")

Cheers
Siva

Posted: Tue Jul 13, 2004 1:57 am
by ray.wurlod
For single-character replacement, Convert is more efficient than Ereplace.

The original YMD follows the default rule, returning the shortest possible string for each component. This is where the zero from the month vanished to. Specifying [4,2,2] forces the conversion to use that many digits for each comparison.

Another way to solve this problem is to do a double conversion. If you have a lot of these, create a Transform (which is then a re-usable component).

Code: Select all

Oconv(TheDate, "DYMD[4,2,2]":@VM:"MCN")
The "MCN" conversion causes only numeric characters to remain in the converted string.

Posted: Tue Jul 13, 2004 2:21 am
by badri
Thanks a lot ..