Playing with Date-type data

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
kumarjit
Participant
Posts: 99
Joined: Fri Oct 12, 2012 7:47 am
Location: Kolkata

Playing with Date-type data

Post by kumarjit »

I have a requirement , something like this :

In our parallel job, we need to read a source file , one of the fields of which contain data like :
08/24/2012 23:11:15

What we intend is to transform it to a format like :
2012-08-24 11:11:15 PM

I was looking ahead to use the OCONV function(as because I want to display the AM/PM portions also , which calls in for a tranformation that can yield data as per a custom external format) to acheive this , but seriuosly , no idea at all about the arguments of the fucntion.

Any help is truly appreciated.

Regards
Kumarjit.
Pain is the best teacher, but very few attend his class..
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

You can't use I/OConv as they are Server functions. You should be able to use StringToTimestamp however are you certain you need it in 12 hour AM/PM format?
-craig

"You can never have too many knives" -- Logan Nine Fingers
kumarjit
Participant
Posts: 99
Joined: Fri Oct 12, 2012 7:47 am
Location: Kolkata

Post by kumarjit »

StringToTimeStamp works good only if the DELIMETER in the date field is "-" (as set at Project level) and not "/" (as is in my case).
And yes , the 12 hour format (AM/PM) is required (that is the core of this requirement).


Regards
Kumarjit.
Pain is the best teacher, but very few attend his class..
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

StringToTimestamp works with any delimiter. You specify it in the format string you pass to the function.
-craig

"You can never have too many knives" -- Logan Nine Fingers
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Clarify for us the data type of the target - is it specifically a Timestamp or is it another string? For the latter use TimestampToString after the initial conversion and use '%(HH,u)' to get it back to a string with the time in 12 hour format with an upper case AM/PM.
-craig

"You can never have too many knives" -- Logan Nine Fingers
Post Reply