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
sankar18
Participant
Posts: 34
Joined: Mon Dec 16, 2002 1:18 am

Date Format

Post by sankar18 »

Hi All,

Merry Christmas.

When we are trying to format date using the following function

OConv(Iconv(SourceLink.Doc,"D2"),"D-DMY[2,A3,A]")

I got the output for the date 11/03/1990 as follows

11-Mar-HORSE.

Is this a syntax Error or Explain us the output refering the animal name in which country usage.

Thanks in advance,
T Sankar
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

What format do you *want* the output to be in? From reading the docs, it looks like you are getting exactly what you asked for, based on the codes you've used.

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

Post by ray.wurlod »

Your "A" specification for display of year gives the name of the year (by default the Chinese astrological name, for example the year beginning 1 Feb 2003 is the year of the GOAT). I suspect you wanted to use "4" (meaning a four digit year). For example:
OConv(Iconv(SourceLink.Doc,"D"),"D-DMY[2,A3,4]")

The first "D" in the specification signals that a date conversion is being performed. "D" alone is sufficient for Iconv() provided that the day, month, year order is correct for your locale; if you are receiving DMY order dates but your locale uses MDY, then specify the DMY specificially, for example Iconv(SourceLink.Doc,"DDMY").
The "-" character after the first "D" is the delimiter character to be used. The "DMY" specifies day, month, year order. The items inside square brackets format the date explicitly; the "2" indicates two digits for the day number, zero filled if required. "A3" specifies a three letter alphabetic representation of the month, and so on. There are numerous possibilities; consult the sections of the BASIC manual on date conversion for myriad examples. DataStage help has quite a few too.


Ray Wurlod
Education and Consulting Services
ABN 57 092 448 518
Post Reply