how to add 2 input time columns
for example:
input A ----- 200408160545
YYMMDDHHSS (YEAR/MONTH/HOUR/SEC)
+
input B ------ 0030(HOUR/SS)
OUTPUT SHOULD BE IN THS FORMAT: 200408160615
how to add two input time columns
Moderators: chulett, rschirm, roy
The DataStage PX developer's guide lists the date/time functions on pages B-1 and B-2; if you convert you string to a timestamp you can use those functions. Another way would be to do your own date math; convert the characters yourself into numbers representing yyyy, mm, dd and hh:mm:ss and do the math, then use the builtin functions to convert that to your requested output format.
In this case it might be best to convert the string date into a julian date which makes maths easier, then convert that julian date to a display date.
In this case it might be best to convert the string date into a julian date which makes maths easier, then convert that julian date to a display date.
<a href=http://www.worldcommunitygrid.org/team/ ... TZ9H4CGVP1 target="WCGWin">
</a>
</a>
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
You're almost certainly going to need something custom here, because there's nothing out of the box to add date/time data.
Be aware that you need to handle situations like the result not being on the same day as the original date/time, and possibly a negative time to add.
Be aware that you need to handle situations like the result not being on the same day as the original date/time, and possibly a negative time to add.
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.
-
- Charter Member
- Posts: 130
- Joined: Mon Sep 06, 2004 3:05 am
- Location: Dubai,UAE
Hi arasan,
TimestampFromSecondsSince(seconds,timestamp) Function
Use the StringToTimestamp(string,"%yyyy%mm%dd%hh%nn") function to convert the string to Timestamp
Convert the input B ------(HOUR/SS) into seconds
e.g. 1330 = (13*60*60+30) seconds
and then use the above function (TimestampFromSecondsSince) to add the seconds to the timestamp and you will get the desired result.
Hope this helps
TimestampFromSecondsSince(seconds,timestamp) Function
Use the StringToTimestamp(string,"%yyyy%mm%dd%hh%nn") function to convert the string to Timestamp
Convert the input B ------(HOUR/SS) into seconds
e.g. 1330 = (13*60*60+30) seconds
and then use the above function (TimestampFromSecondsSince) to add the seconds to the timestamp and you will get the desired result.
Hope this helps
Warm Regards,
Amruta Bandekar
<b>If A equals success, then the formula is: A = X + Y + Z, X is work. Y is play. Z is keep your mouth shut. </b>
--Albert Einstein
Amruta Bandekar
<b>If A equals success, then the formula is: A = X + Y + Z, X is work. Y is play. Z is keep your mouth shut. </b>
--Albert Einstein