gmt data

Post questions here relative to DataStage Server Edition for such areas as Server job design, DS Basic, Routines, Job Sequences, etc.

Moderators: chulett, rschirm, roy

Post Reply
randy
Participant
Posts: 30
Joined: Tue Sep 13, 2005 11:17 am

gmt data

Post by randy »

A new data file is containg date/time formated as gmt.
I need to load this into an Oracle table, but am not sure how to handle it.

Can someone help me?

Thanks
Randy
kcbland
Participant
Posts: 5208
Joined: Wed Jan 15, 2003 8:56 am
Location: Lutz, FL
Contact:

Post by kcbland »

You mean Greenwich Mean Time? Are you asking how to add X hours to a date time to make it local to your standard? Write a DS function, search the forum, there's lots of examples.
Kenneth Bland

Rank: Sempai
Belt: First degree black
Fight name: Captain Hook
Signature knockout: right upper cut followed by left hook
Signature submission: Crucifix combined with leg triangle
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Look at the SDK routines - there's processing available there for GMT. You do have to know your timezone to convert. And be aware of summer time shifts.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
randy
Participant
Posts: 30
Joined: Tue Sep 13, 2005 11:17 am

Post by randy »

I did a search for gmt and found very little.
kcbland
Participant
Posts: 5208
Joined: Wed Jan 15, 2003 8:56 am
Location: Lutz, FL
Contact:

Post by kcbland »

Look at the final message on this post from DSGuru2B:

viewtopic.php?t=100080&highlight=add+date
Kenneth Bland

Rank: Sempai
Belt: First degree black
Fight name: Captain Hook
Signature knockout: right upper cut followed by left hook
Signature submission: Crucifix combined with leg triangle
randy
Participant
Posts: 30
Joined: Tue Sep 13, 2005 11:17 am

Post by randy »

Thanks,

the GMT data looks like this: 0493558525

I am not sure how to sure the examples, but will spend the night working on it.
kcbland
Participant
Posts: 5208
Joined: Wed Jan 15, 2003 8:56 am
Location: Lutz, FL
Contact:

Post by kcbland »

No, your date is EPOCH, the number of seconds since Jan 1, 1970. I don't know if we've got one of those.
Kenneth Bland

Rank: Sempai
Belt: First degree black
Fight name: Captain Hook
Signature knockout: right upper cut followed by left hook
Signature submission: Crucifix combined with leg triangle
Krazykoolrohit
Charter Member
Charter Member
Posts: 560
Joined: Wed Jul 13, 2005 5:36 am
Location: Ohio

Post by Krazykoolrohit »

use the iconv and oconv functions to convert. check datastage help for usage
kcbland
Participant
Posts: 5208
Joined: Wed Jan 15, 2003 8:56 am
Location: Lutz, FL
Contact:

Post by kcbland »

I suppose you could take your EPOCH value, divide it by 86400 (the number of seconds in a day) to get the whole number of days in the date. The DS BASIC internal date starts at 1 on January 1, 1968. So, you can work out the equation necessary to compute the date value you need. Then, take the number of seconds remaining when dividing your EPOCH by 86400 and turn that into hours, minutes, and seconds and construct your final timestamp value in the forum YYYY-MM-DD HH24:MI:SS.
Kenneth Bland

Rank: Sempai
Belt: First degree black
Fight name: Captain Hook
Signature knockout: right upper cut followed by left hook
Signature submission: Crucifix combined with leg triangle
kcbland
Participant
Posts: 5208
Joined: Wed Jan 15, 2003 8:56 am
Location: Lutz, FL
Contact:

Post by kcbland »

Krazykoolrohit wrote:use the iconv and oconv functions to convert. check datastage help for usage
No. ICONV and OCONV work on integer days, not seconds. The time conversions don't include date components. You must write a custom function.
Kenneth Bland

Rank: Sempai
Belt: First degree black
Fight name: Captain Hook
Signature knockout: right upper cut followed by left hook
Signature submission: Crucifix combined with leg triangle
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

There are 1900 and 1970 epoch Transforms in the SDK.
DateGenericToDaysSince1900
DateGenericToDaysSince1970

You actually need the reverse of these, to calculate the date that is so many seconds since 1900-01-01 00:00:00

You can convert seconds to days by dividing by 86400. If all you want is the date, use

Code: Select all

Oconv(Int(InLink.MyEpoch/86400)-Iconv("1970-01-01","DYMD"),"D-YMD[4,2,2]")
or something similar, depending on your base date.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Post Reply