Elapsed Time function [HH]:MM:SS
Moderators: chulett, rschirm, roy
-
- Participant
- Posts: 12
- Joined: Thu Jun 29, 2017 9:48 am
- Location: Washington DC
Elapsed Time function [HH]:MM:SS
Does DataStage have an Elapsed Time / Duration function? Convert "MM:SS" to "[HH]:MM:SS". Example: "62:15" to "01:02:15". Thanks.
There appear to be 2 questions here.
Formatting is easy. Timestamps are just a number under the hood, how you want them to appear as a human readable string is up to you and highly configurable.
Run time depends on what you want really. You can get it after the fact with director or other tools, and you can get it live off the link/stage data with routines to name a couple of approaches.
Formatting is easy. Timestamps are just a number under the hood, how you want them to appear as a human readable string is up to you and highly configurable.
Run time depends on what you want really. You can get it after the fact with director or other tools, and you can get it live off the link/stage data with routines to name a couple of approaches.
-
- Participant
- Posts: 12
- Joined: Thu Jun 29, 2017 9:48 am
- Location: Washington DC
that was what we are asking. If they are strings, you have to convert from string to time back to string.phipsijuice wrote:Thanks for the reply. It's really just one question. I thought DS might have a function similar to Excel where you can convert "MM:SS" to "[HH]:MM:SS". Obviously I can do the math and formatting through the Transformer Stage but thought there would be a more efficient way?
if they are times, you can manipulate time and convert once at the end to print it.
Datastage cannot directly do math on strings. It needs either implicit or explicit conversions.
-
- Participant
- Posts: 12
- Joined: Thu Jun 29, 2017 9:48 am
- Location: Washington DC
I don't know of a way to avoid conversions. You may be able to let DS convert for you by flowing from text to timestamp to text again in metadata on the columns, or you may decide to do it yourself. The metadata approach will avoid the extra transformer, but the work being done is more or less the same. You don't need a transformer to reshape the strings; many stage allow the transformer string functions inside. If you have one of the stages that allows it, you can do it there.
-
- Participant
- Posts: 12
- Joined: Thu Jun 29, 2017 9:48 am
- Location: Washington DC