Regarding Date conversion

Post questions here relative to DataStage Enterprise/PX Edition for such areas as Parallel job design, Parallel datasets, BuildOps, Wrappers, etc.

Moderators: chulett, rschirm, roy

Post Reply
satishm
Participant
Posts: 22
Joined: Wed Aug 20, 2008 6:37 am

Regarding Date conversion

Post by satishm »

Hi,
Can some one assist in converting a date from one format to another.

eg:
Input Date : 2009-12-31 ( yyyy-mm-dd) data-type : Date

Output Required : 31-12-2009 ( dd-mm-yyyy) data-type : Date

Regards,
SatishM.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

A date is a date, only date values in string fields have formats like you are showing. You can use "[]", the substring operators, to re-arrange the parts of those external dates or the StringToDate / DateToString functions.
Last edited by chulett on Mon Nov 30, 2009 4:39 pm, edited 1 time in total.
-craig

"You can never have too many knives" -- Logan Nine Fingers
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Dates do not have formats. Dates are stored in binary format.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
vishal_rastogi
Participant
Posts: 47
Joined: Thu Dec 09, 2010 4:37 am

Re: Regarding Date conversion

Post by vishal_rastogi »

satishm wrote:Hi,
Can some one assist in converting a date from one format to another.

eg:
Input Date : 2009-12-31 ( yyyy-mm-dd) data-type : Date

Output Required : 31-12-2009 ( dd-mm-yyyy) data-type : Date

Regards,
SatishM.
you can convert first date to string then and then again string to date
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

No reason for anything like that, if both the source and target are a "date" data type as (as noted) there are no format to dates, they are stored internally in binary. Now if only one end or the other is a Date or there are two Strings involved then those functions are the way to go.
-craig

"You can never have too many knives" -- Logan Nine Fingers
Post Reply