Date Format

Post questions here relative to DataStage Server Edition for such areas as Server job design, DS Basic, Routines, Job Sequences, etc.

Moderators: chulett, rschirm, roy

Post Reply
badri
Participant
Posts: 19
Joined: Mon Jul 12, 2004 2:58 am

Date Format

Post 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
rasi
Participant
Posts: 464
Joined: Fri Oct 25, 2002 1:33 am
Location: Australia, Sydney

Post by rasi »

Hi Badri

You had missed the syntax.

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

Cheers
Siva
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post 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.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
badri
Participant
Posts: 19
Joined: Mon Jul 12, 2004 2:58 am

Post by badri »

Thanks a lot ..
Post Reply