military to standard time conversion

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
hargun
Participant
Posts: 188
Joined: Mon May 16, 2011 7:41 pm
Location: United States

military to standard time conversion

Post by hargun »

hello,

i am tried to do conversion from military format to standard format.

the job design is

db2 stage...........xfm..................oracle

The source column datatype is char and want to load according to standard time format. The target column datatype is varchar.
the current format is 22.48.51 but in output required 10:48:51 PM

i tried by string to time conversion but not works.

Can you please help me on this.
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Convert the inbound string to a time using StringToTime() with an appropriate format specification (such as "%hh.%nn.%ss").

Wrap that result in a TimeToString() function with a format string that specifies your desired output format.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
rkashyap
Premium Member
Premium Member
Posts: 532
Joined: Fri Dec 02, 2011 12:02 pm
Location: Richmond VA

Post by rkashyap »

Code for implementing Ray's suggestion is:

Code: Select all

TimeToString(StringToTime(INLink.INTIME,"%hh:%nn:%ss"),"%HH:%nn:%ss %aa")
where INLink.INTIME is incoming time.
hargun
Participant
Posts: 188
Joined: Mon May 16, 2011 7:41 pm
Location: United States

Post by hargun »

thanks it works
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Give a man a fish...
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

And in case you are unfamiliar with the Chinese Proverb:

"If you give a man a fish you feed him for a day. If you teach a man to fish you feed him for a lifetime."

We generally prefer to teach fishing around here rather than simply hand out fish.
-craig

"You can never have too many knives" -- Logan Nine Fingers
rkashyap
Premium Member
Premium Member
Posts: 532
Joined: Fri Dec 02, 2011 12:02 pm
Location: Richmond VA

Post by rkashyap »

Point understood. Thanks.
Post Reply