(my English writing level is low...sorry T_T)
Hi
I had a job like this
===========================
= Sequencefile => Transformer => DB2 =
===========================
one column of source sequence file is '1435668237'
this is seconds
I wanna insert data to target DB2 like this format
'YYYYMMDD'
a method of cacaluation is '1970-1-01 09:00:00' add '1435668237 seconds'
result => YYYYMMDD
I had a solution by SQL query....
but I wanna know a way by DS Function or Routine
Plz give me lessons
thanks for reading my topic
how to "YYYY-MM-DD HH:MM:SS" add ########## second
Moderators: chulett, rschirm, roy
how to "YYYY-MM-DD HH:MM:SS" add ########## second
Last edited by zealcrash on Wed Mar 12, 2008 12:54 am, edited 2 times in total.
ZealCrash
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
In server edition dates are stored as days since 1967-12-31, and times as seconds since midnight. You need to tear apart your timestamp into date and time portions, and convert your increment into days and seconds.
Code: Select all
svStartDay = Iconv(Field(InLink.TheTimestamp, " ", 1, 1),"DYMD")
svStartTime = Iconv(Field(InLink.TheTimestamp, " ", 2, 1), "MTS")
svIncrDays = Int(InLink.Seconds / 3600)
svIncrSecs = Mod(InLink.Seconds, 3600)
svResultDays = svStartDay + svIncrDays
svResultSecs = svStartTime + svIncrSecs
svNewDays = (If svResultSecs >= 86400 Then svResultDays - 1 Else svResultDays)
svNewSecs = (If ResultSecs >= 86400 Then svResultSecs - 86400 Else svResultSecs)
svNewTimestamp = Oconv(svNewDays, "D-YMD[4,2,2]") : " " : Oconv(svNewSecs, "MTS:")
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
-
- Participant
- Posts: 6
- Joined: Tue Jan 29, 2008 3:48 am
- Location: Chennai