How to get timestamp with microsecond

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
hailun
Participant
Posts: 40
Joined: Fri Nov 07, 2008 9:07 am

How to get timestamp with microsecond

Post by hailun »

Hi,

In project,we need get time-stamp and what we are doing is achieving this via CurrentTimestamp() function in D/S transformer stage but we can only get a value timed to second such as '2004-03-02 16:28:26', and now we wanna one value timed to microsecond such as '2010-08-05 13:29:09.970000',is there any way.

BTW,current datastage version is 7.5.1:
uv -admin -version
DataStage 7.5.1.2

Appreciating your input in advance,

Thanks,
Let's Progress Together....
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

What operating system? An exact search for "microsecond" should turn up other conversations on this topic, including (from what I recall) the operating systems where this does or does not work.
-craig

"You can never have too many knives" -- Logan Nine Fingers
mhester
Participant
Posts: 622
Joined: Tue Mar 04, 2003 5:26 am
Location: Phoenix, AZ
Contact:

Post by mhester »

Try CurrentTimestampMS() and set the extended properties of the column to include micro seconds and set length to 26 and scale to 6.

CurrentTimestamp() will give just seconds as you presented if the extended properties are not set. If they are you would get 000000 as the micro seconds.

Using CurrentTimestampMS() should solve your issue.
hailun
Participant
Posts: 40
Joined: Fri Nov 07, 2008 9:07 am

Post by hailun »

chulett wrote:What operating system? An exact search for "microsecond" should turn up other conversations on this topic, including (from what I recall) the operating systems where this does or does not work.
Hi chulett,thanks a lot for reply, OS is AIX 5.1,I seached the forum,but unble to get the answer :(
Let's Progress Together....
hailun
Participant
Posts: 40
Joined: Fri Nov 07, 2008 9:07 am

Post by hailun »

mhester wrote:Try CurrentTimestampMS() and set the extended properties of the column to include micro seconds and set length to 26 and scale to 6.

CurrentTimestamp() will give just seconds as you presented if the extended properties are not set. If they are you would get 000000 as the micro seconds.

Using CurrentTimestampMS() should solve your issue.
Hi mhester,many thanks for reply,I tried you method but I'm unabe to see fucntion CurrentTimestamp() in the transfermor stage,,seems 7.X D/S has no function CurrentTimestampMS() :(
Let's Progress Together....
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

You may need to upgrade or roll you own. Also, Mike has already mentioned this but so has Arnd in the past:
ArndW wrote:You will need to declare your Timestamp column with the extended attribute of "microseconds" in order to store fraction seconds.
Have you enabled that attribute?
-craig

"You can never have too many knives" -- Logan Nine Fingers
mhester
Participant
Posts: 622
Joined: Tue Mar 04, 2003 5:26 am
Location: Phoenix, AZ
Contact:

Post by mhester »

Here you go - something to get you started with your own -

Code: Select all

char *pfGetTimestamp()
{

    char* returnBuffer;

    TimeStampStringValue = APT_TimeStamp::now(true).asString();

    returnBuffer = TimeStampStringValue.content();

    return  returnBuffer;

}
Post Reply