Page 1 of 1

Data Conversion

Posted: Tue Mar 25, 2008 9:59 am
by tguthrie226
How do I take an internal InfoLease system date and convert it to MMDDYYYY without the / showing up? I am getting MM/DD/YYYY.

I have tried individual conversions on the date field with DM[2] DD[2] and DY[4], I have tried "DMDY[2,2,4], and I have tried MDY with no success.

Thanks.

Posted: Tue Mar 25, 2008 10:26 am
by DSguru2B
Welcome Aboard,
What is your income date format?
Based on that you can perform an ICONV on it and then an OCONV with the format as "DMDY[2,2,4]":@VM:"MCN". This will give you MMDDYYYY format.

Posted: Tue Mar 25, 2008 10:28 am
by kcbland
Welcome aboard! Common date manipulations are covered extensively here. Spend a little time and browse the 100 thousand plus questions and answers.

If you want me to give you a hint, look for conversations regarding using ICONV and OCONV to facilitate date manipulations. Your solution could also be solved using simple string manipulation to remove the / character. Search for tips on using EREPLACE and CHANGE and TRIM. You can look these functions up in the DS BASIC manual available under your Start button for Ascential, under Online Documentation.

Posted: Tue Mar 25, 2008 10:29 am
by chulett
DSG2B: It would probably help if you also explained what exactly that is doing, the 'how' of the 'what', if you will. :wink:

regarding data conversion

Posted: Tue Mar 25, 2008 10:38 am
by arun_kumar
Hi,

can you make the question clear,you want the output to be in that specified foramt or data convesion.

Updated Information

Posted: Tue Mar 25, 2008 10:53 am
by tguthrie226
I have tried:

Oconv(FedDepr.BEG_DEPR_DATE, "MDY[2,2,4]" :@VM:"MCN") which produces:
03/21/1999

I have also tried: Oconv(DateTimeStampToInternal(AsMast.A_DISP_DATE) , "DM[2]"):Oconv(DateTimeStampToInternal(AsMast.A_DISP_DATE) , "DD"):Oconv(DateTimeStampToInternal(AsMast.A_DISP_DATE) , "DY") Else "" which produces:
03011999

so it appears that it rolls the day portion of the date back the 1st each time.

Re: Updated Information

Posted: Tue Mar 25, 2008 11:20 am
by gateleys
Try this -

Code: Select all

Oconv(FedDepr.BEG_DEPR_DATE, "MDY[2,2,4]","MCN")
The MCN conversion code extracts only the numerals from the input string.

Posted: Tue Mar 25, 2008 11:24 am
by DSguru2B
chulett wrote:DSG2B: It would probably help if you also explained what exactly that is doing, the 'how' of the 'what', if you will. :wink:
Sure. You can provide multiple mainpulations on a string using a single ICONV or OCONV function by delimiting the conversions with a value mark (@VM) character. Hence, first change the internal date to MM DD YYYY format and then apply "MCN" which will extract the numbers out of the date, in turn, getting rid of the spaces.

So gateleys conversion code is missing the @VM character. Hence, it will now be

Code: Select all

Oconv(FedDepr.BEG_DEPR_DATE, "MDY[2,2,4]":@VM:"MCN")
provided the incoming date is in internal format. Else change it to internal format by using ICONV().

Transform Function

Posted: Tue Mar 25, 2008 11:25 am
by tguthrie226
I ended up building this transform and it works.

Ans = DSDate[6,2]:DSDate[9,2]:DSDate[1,4]

SunTrustDateFormatNew(FedDepr.BEG_DEPR_DATE)

Posted: Tue Mar 25, 2008 11:28 am
by kcbland
Why y'all given out the answers to our friend from Atlanta? Why not let them discover our rich answer history here? Sometimes you learn a lot more than finding out an answer you care about...

Posted: Tue Mar 25, 2008 11:29 am
by DSguru2B
kcbland wrote:Why y'all given out the answers to our friend from Atlanta? Why not let them discover our rich answer history here? Sometimes you learn a lot more than finding out an answer you care about...
I was just explaining my cryptic code. Forgot to do it the first time. :roll:

Posted: Tue Mar 25, 2008 11:45 am
by chulett
Or:

Code: Select all

Convert("/","",Oconv(FedDepr.BEG_DEPR_DATE, "MDY[2,2,4]"))
Might make it a little more obvious what's going on.

Posted: Tue Mar 25, 2008 11:47 am
by gateleys
DSguru2B wrote:So gateleys conversion code is missing the @VM character.
Ooops!!

If you want to go without the Value Mark, you would need to go with a double call to Oconv -

Code: Select all

Oconv(Oconv(FedDepr.BEG_DEPR_DATE, "MDY[2,2,4]"),"MCN")

Posted: Tue Mar 25, 2008 3:10 pm
by ray.wurlod
Given the original problem I'd use a DIGITS Transform.

Code: Select all

DIGITS(InLink.TheDate)