date conversion from 05aug08 to yymmdd

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
kkumardatastage
Participant
Posts: 84
Joined: Sat Jul 19, 2008 8:50 am

date conversion from 05aug08 to yymmdd

Post by kkumardatastage »

hi
pls can any one help me to converting the date formet from

1) 05aug08 to yymmdd and
2) 05aug08 to yyyymmdd.

i am using datastage parallel
this conversion i am doing in transformer.
pls can any get me a solution
thank you
DSguru2B
Charter Member
Charter Member
Posts: 6854
Joined: Wed Feb 09, 2005 3:44 pm
Location: Houston, TX

Post by DSguru2B »

Try looking into StringToDate using the mask '%dd%mmm%yy'. This will convert your string to date. The output format will depend upon what you have set at the project level for dates.
Creativity is allowing yourself to make mistakes. Art is knowing which ones to keep.
kkumardatastage
Participant
Posts: 84
Joined: Sat Jul 19, 2008 8:50 am

Re: date conversion from 05aug08 to yymmdd

Post by kkumardatastage »

kkumardatastage wrote:hi
pls can any one help me to converting the date formet from

1) 05aug08 to yymmdd and
2) 05aug08 to yyyymmdd.

i am using datastage parallel
this conversion i am doing in transformer.
pls can any get me a solution
thank you

Try looking into StringToDate using the mask '%dd%mmm%yy'. This will convert your string to date. The output format will depend upon what you have set at the project level for dates.


pls can u tell me in detail i did't got u properly.
thank you
kkumardatastage
Participant
Posts: 84
Joined: Sat Jul 19, 2008 8:50 am

Post by kkumardatastage »

DSguru2B wrote:Try looking into StringToDate using the mask '%dd%mmm%yy'. This will convert your string to date. The output format will depend upon what you have set at the project level for dates.
pls can u tell me in detail i did't get u properly
thank you
DSguru2B
Charter Member
Charter Member
Posts: 6854
Joined: Wed Feb 09, 2005 3:44 pm
Location: Houston, TX

Post by DSguru2B »

Read about StringToDate() in your manuals to get an understanding of how these functions work.
Your incoming format is %dd%mmm%yy, so you will feed this to StringToDate.

Code: Select all

StringToDate(in.col, '%dd%mmm%yy')
this will convert your String into Date.
Now as for your output format, that depends upon your project level settings for Date.
Creativity is allowing yourself to make mistakes. Art is knowing which ones to keep.
kkumardatastage
Participant
Posts: 84
Joined: Sat Jul 19, 2008 8:50 am

Post by kkumardatastage »

DSguru2B wrote:Read about StringToDate() in your manuals to get an understanding of how these functions work.
Your incoming format is %dd%mmm%yy, so you will feed this to StringToDate.

Code: Select all

StringToDate(in.col, '%dd%mmm%yy')
this will convert your String into Date.
Now as for your output format, that depends upon your project level settings for Date.
hi
thank you for u r help, i am getting output but in view data the date in appering as all *********. but i need to get in the form of (yyyymmdd) for ex:my input is in form 05AUG08 and my output in the view data should be in format of (20080805). pls can u give me some solution for this
thank you one's again
DSguru2B
Charter Member
Charter Member
Posts: 6854
Joined: Wed Feb 09, 2005 3:44 pm
Location: Houston, TX

Post by DSguru2B »

Is your output date or a string format? Lets start with that before we jump any forward.
Creativity is allowing yourself to make mistakes. Art is knowing which ones to keep.
kkumardatastage
Participant
Posts: 84
Joined: Sat Jul 19, 2008 8:50 am

Post by kkumardatastage »

DSguru2B wrote:Is your output date or a string format? Lets start with that before we jump any forward.
hi
the target column for the date is in the verchar
thank you
poornima.chandramouli
Participant
Posts: 42
Joined: Wed Dec 26, 2007 1:58 am
Location: India

Post by poornima.chandramouli »

kkumardatastage wrote:
DSguru2B wrote:Is your output date or a string format? Lets start with that before we jump any forward.
hi
the target column for the date is in the verchar
thank you
Hi,

Are you using this conversion as a part of your stage variables.
If you are doing so, then check the order of execution of your stage variables.
Regards
sandeepgs
Participant
Posts: 87
Joined: Wed Jul 02, 2008 12:22 am

Post by sandeepgs »

Hi,

Question : To convert format of date.

1) 05aug08 to yymmdd and
2) 05aug08 to yyyymmdd

Solution: Use this function in transformer It will work.

This is for fist one:

DateToString(StringToDate(DSLink8.a,"%dd%mmm%yy"),"%yy%mm%dd")

Second one:

DateToString(StringToDate(DSLink8.a,"%dd%mmm%yy"),"%yyyy%mm%dd")

Note : DSLink8.a is a column name specifiy the incomming column name here.
kkumardatastage
Participant
Posts: 84
Joined: Sat Jul 19, 2008 8:50 am

Post by kkumardatastage »

sandeepgs wrote:Hi,

Question : To convert format of date.

1) 05aug08 to yymmdd and
2) 05aug08 to yyyymmdd

Solution: Use this function in transformer It will work.

This is for fist one:

DateToString(StringToDate(DSLink8.a,"%dd%mmm%yy"),"%yy%mm%dd")

Second one:

DateToString(StringToDate(DSLink8.a,"%dd%mmm%yy"),"%yyyy%mm%dd")

Note : DSLink8.a is a column name specifiy the incomming column name here.
hi
thank you for u r help, i used DateToString(StringToDate(DSLink8.a,"%dd%mmm%yy"),"%yy%mm%dd") i am getting output but in view data the date in appering as all *********. but i need to get in the form of (yyyymmdd) for ex:my input is in form 05AUG08 in verchar and my output in the view data should be in format of (20080805)(verchar). pls can u give me some solution for this

thank you
:cry:
singhald
Participant
Posts: 180
Joined: Tue Aug 23, 2005 2:50 am
Location: Bangalore
Contact:

Post by singhald »

first correct your expression to get correct required ouput format in yyyymmdd,


Incorrect= DateToString(StringToDate(DSLink8.a,"%dd%mmm%yy"),"% yy%mm%dd ")
Correct =DateToString(StringToDate(DSLink8.a,"%dd%mmm%yy"),"%yyyy%mm%dd")

now check the datatype for this field in the ouput stage. it should be varchar 8,

also open the file and see the data format, dont worry about the datastage view option,

Regards
Regards,
Deepak Singhal
Everything is okay in the end. If it's not okay, then it's not the end.
Post Reply