date conversion from 05aug08 to yymmdd
Moderators: chulett, rschirm, roy
-
- Participant
- Posts: 84
- Joined: Sat Jul 19, 2008 8:50 am
date conversion from 05aug08 to yymmdd
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
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
-
- Participant
- Posts: 84
- Joined: Sat Jul 19, 2008 8:50 am
Re: date conversion from 05aug08 to yymmdd
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
-
- Participant
- Posts: 84
- Joined: Sat Jul 19, 2008 8:50 am
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.
this will convert your String into Date.
Now as for your output format, that depends upon your project level settings for Date.
Your incoming format is %dd%mmm%yy, so you will feed this to StringToDate.
Code: Select all
StringToDate(in.col, '%dd%mmm%yy')
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.
-
- Participant
- Posts: 84
- Joined: Sat Jul 19, 2008 8:50 am
hiDSguru2B 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.this will convert your String into Date.Code: Select all
StringToDate(in.col, '%dd%mmm%yy')
Now as for your output format, that depends upon your project level settings for Date.
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
-
- Participant
- Posts: 84
- Joined: Sat Jul 19, 2008 8:50 am
-
- Participant
- Posts: 42
- Joined: Wed Dec 26, 2007 1:58 am
- Location: India
Hi,kkumardatastage wrote:hiDSguru2B wrote:Is your output date or a string format? Lets start with that before we jump any forward.
the target column for the date is in the verchar
thank you
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
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.
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.
-
- Participant
- Posts: 84
- Joined: Sat Jul 19, 2008 8:50 am
hisandeepgs 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.
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
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
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.
Deepak Singhal
Everything is okay in the end. If it's not okay, then it's not the end.