ICONV Date / Time format mask

Post questions here relative to DataStage Server Edition for such areas as Server job design, DS Basic, Routines, Job Sequences, etc.

Moderators: chulett, rschirm, roy

Post Reply
MrBlack
Participant
Posts: 125
Joined: Wed Aug 08, 2012 8:57 am

ICONV Date / Time format mask

Post by MrBlack »

Can someone help me with format mask, I'm reading in a text file with data like

Code: Select all

11/16/13 9:30 PM MST
So far I've only used ICONV for just the date portion but I have never done a date/time.

I would expect a mask something like

Code: Select all

ICONV(DSLink1.Arg, "D/MDY HH:MM:SS AM MST")
I did find this website but haven't been able to make any combinations to work so far

http://docs.intersystems.com/cache20082 ... VBS_ficonv
SURA
Premium Member
Premium Member
Posts: 1229
Joined: Sat Jul 14, 2007 5:16 am
Location: Sydney

Re: ICONV Date / Time format mask

Post by SURA »

You may get some hold by referring this thread.

viewtopic.php?t=135681&highlight=MM%2FDD%2FYY
Thanks
Ram
----------------------------------
Revealing your ignorance is fine, because you get a chance to learn.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

You have to split the date from the time and convert them separately.
-craig

"You can never have too many knives" -- Logan Nine Fingers
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

You have to split the date from the time and convert them separately. DataStage BASIC has no knowledge of timestamps in any form. And, in particular, there is no internal format of a timestamp in DataStage BASIC.

Curiously, perhaps, the supplied SDK Transforms and Routines do provide such a thing, though based on a zero point of 1970-01-01 00:00:00.
Last edited by ray.wurlod on Mon Jun 24, 2013 11:33 pm, edited 1 time in total.
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 »

What's your goal here?
-craig

"You can never have too many knives" -- Logan Nine Fingers
bheaton_IHC
Premium Member
Premium Member
Posts: 1
Joined: Thu Mar 04, 2010 2:54 pm

Post by bheaton_IHC »

Here's a template of what I've used before that will return it's output as a string in the Oracle To_Timestamp() format. You should be able to adapt this to suit your needs.

Code: Select all

Oconv(ICONV(Left(ExtractOvrdFile.EVENT_TIME_DTS,10),"D/MDY[2,2,4]"),"D-YMD[4,2,2]") : " " : Oconv(ICONV(Right(ExtractOvrdFile.EVENT_TIME_DTS,8), "MTS"),"MTS")
MrBlack
Participant
Posts: 125
Joined: Wed Aug 08, 2012 8:57 am

Post by MrBlack »

Thanks bheaton_ihc! That's a good example and I should be able to modify that for what I need to do.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

It would have helped if you explained "what you need to do" in its entirety right off the bat rather then just ask about a part of the puzzle. At this point we still don't even know what that is.
-craig

"You can never have too many knives" -- Logan Nine Fingers
MrBlack
Participant
Posts: 125
Joined: Wed Aug 08, 2012 8:57 am

Post by MrBlack »

chulett I did specify the boundries of the problem: Take a date time string and get it into a date-time data type in datastage. What I do with the data from there is my business and out of scope of the problem.

Now with the combined responses from ray.wurlord and bheaton_ihc the problem can be resolved. Thanks to ray we know that datastage/iconv can't handle date-time format masks and thanks to bheaton gives a solutions to separate the data into the two necessary elements for conversion into date-time data type.

Now if you have a more elegant solution I challenge you to post it, otherwise stop trolling that I didn't tell you my overall plan to rule the world when all I wanted was to get a text sting into a date-time data type.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Trolling? Get real.
-craig

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