Convert Unix timestamp

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
srini.dw
Premium Member
Premium Member
Posts: 186
Joined: Fri Aug 18, 2006 1:59 am
Location: Chennai

Convert Unix timestamp

Post by srini.dw »

Hi,

Source is SQL Server, target is Teradata.

Source column is Unix timestamp. 1065531990.

Please let me know how to convert date and time separately.

Searched the forum but could not get exact syntax.

Thank you,
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Start someplace like here:

http://www.unixtimestamp.com/index.php
-craig

"You can never have too many knives" -- Logan Nine Fingers
priyadarshikunal
Premium Member
Premium Member
Posts: 1735
Joined: Thu Mar 01, 2007 5:44 am
Location: Troy, MI

Post by priyadarshikunal »

and the syntax will be something like

Code: Select all

TimestampFromSecondsSince(<unix timestamp column>, StringToTimestamp("1970-01-01 00:00:00","%yyyy-%mm-%dd %hh:%nn:%ss"))
1065531990 gives the result
2003-10-07 13:06:30 (7th oct 2003 13:06:30)

while the link posted by Craig calculates it to
10 / 07 / 03 @ 8:06:30am (7th oct 2003 8:06:30)

since its just a offset from 1st jan 1970 probably that site is converting it to -5 hrs.
Priyadarshi Kunal

Genius may have its limitations, but stupidity is not thus handicapped. :wink:
srini.dw
Premium Member
Premium Member
Posts: 186
Joined: Fri Aug 18, 2006 1:59 am
Location: Chennai

Post by srini.dw »

Thank you, Priyadarshi Kunal.

Iam able to get the expected result with the conversation give by you.
Post Reply