Page 1 of 1

About @DATE

Posted: Fri Feb 03, 2006 12:09 am
by puli.reddy
Hi,

I am using @DATE function to populate current date value. When I was viewing DSDB2 column values using datastage after population, it shows values as 13914 (2006-02-03). In DB2 it shows in specific format 02/03/2006.
Why it is showing same value in two different ways?

How will I extract year and month values in the format "YYYYMM" from @DATE function

Thanks in advance.

Posted: Fri Feb 03, 2006 12:31 am
by srividya
@Date gives the Internal Date
13914 is the internal date of datastage
Did you check the DCode Function?

if not pls check it
it will help you with the all the Date conversions you need
and the answer for
How will I extract year and month values in the format "YYYYMM" from @DATE function
will also be there

is it mandatory that you extract YYYYMM from @Date only? There are lot other functions can give you the result

ex:@Year:@Month

Posted: Fri Feb 03, 2006 12:34 am
by ArndW
The DB/2 interface will automatically do the conversion from the internal date representation inside DataStage to the external date format for you. This is the one exception where you don't need to manually take care of this conversion.

Posted: Fri Feb 03, 2006 1:08 am
by puli.reddy
Hi Vidya,

Thanks for ur response. I couldn't find any help on DCode function. Do u mean Iconv and Oconv or DCode is an independent one.

By using following expression I get YYYYMM format
Oconv(Iconv(@YEAR,"DY[2]"),"DY[4]") : Oconv(Iconv(@MONTH,"DM[2]"),"DM[2]")

I am curious to get by using @DATE
I was using the following expression to get
Oconv(@DATE,"DYM[4,2]")

but it gives a blank value between year and month.

Any help would be appreciated..

Posted: Fri Feb 03, 2006 3:05 am
by kcshankar
Hi Puli.reddy,

Code: Select all

I am curious to get by using @DATE 
I was using the following expression to get 
Oconv(@DATE,"DYM[4,2]") 
but it gives a blank value between year and month. 
try this to extract year and month values in the format "YYYYMM" from @DATE function

Oconv(@DATE, "D YM")

regards
kcs

Posted: Fri Feb 03, 2006 3:31 am
by srividya
Hi Angi garu

what did u mean by blank value?
The space coming between year and date?
the result for

Code: Select all

OConv(@Date,'DYM[4,2]')

will be 2006 02
the space,i guess., is the separator between year and month.Correct me if I'm wrong
to have a better idea., try this one

Code: Select all

OConv(@Date,'D-YM[4,2]')

it will give the result as 2006-02

I couldn't find any help on DCode function.
its D Code not DCode....search for D Code (Space between D and Code :) )

Posted: Fri Feb 03, 2006 3:58 am
by Sunshine2323
Hi puli.reddy,

Try this,

OCONV(@DATE,"DY"):OCONV(@DATE,"DM[2]")

Hope this helps :)

Posted: Fri Feb 03, 2006 4:04 am
by ray.wurlod
This paper may also shed some light on date conversions.

Thanks everyone

Posted: Sat Feb 04, 2006 11:50 pm
by puli.reddy
It seems every one is keen in posting a solution. I like this approach from this site. I never got quick solution from any other forum other than this. Keep it up dsxchangers....

Thanks everyone ..

The solution from Amruta is working in my case Oconv(@DATE,"DY") : Oconv(@DATE,"DM[2]")

Yes vidya I mean to say a space was coming between year and month.

Sekhar, ur method nor did

Posted: Sun Feb 05, 2006 2:32 pm
by ray.wurlod

Code: Select all

Oconv(@DATE, "DYM[4,2]" : @VM : "MCN") 
is slightly more efficient.