Timestamp 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

ArndW
Participant
Posts: 16318
Joined: Tue Nov 16, 2004 9:08 am
Location: Germany
Contact:

Post by ArndW »

info_ds wrote:hi ray,

i tried and got the result --> 19950512

any suggestions?
No suggestions from anyone, it works just like it is supposed to.
lshort
Premium Member
Premium Member
Posts: 139
Joined: Tue Oct 29, 2002 11:40 am
Location: Toronto

Post by lshort »

hi lance,

mydate= 'May 12 1995 12:00:00.000 AM'
DateToString(StringToDate(mydate[1,11],"%mmm %dd %yyyy"),"%yyyy%mm%dd")
can we implement this way?
That is certainly simple enough. I didnt think of that.
One thing to keep in mind. It was noted in a previous post that if the DAY is "1" instead of "01" then the Date functions do not work properly.


Works! -->mydate= 'May 01 1995 12:00:00.000 AM'
Doesnt Work! -->mydate= 'May 1 1995 12:00:00.000 AM'
Lance Short
"infinite diversity in infinite combinations"
***
"The absence of evidence is not evidence of absence."
lshort
Premium Member
Premium Member
Posts: 139
Joined: Tue Oct 29, 2002 11:40 am
Location: Toronto

Post by lshort »

Ray wrote:
Lance,
Check out the lookup_int16_from_string operator in the Modify stage
Page 27-9 of Parallel Job Developer's Guide for v7.x
Thanks for the tip. Very cool. Kinda like locate() function on server side.

btw: how do you find this stuff?
....did you read the manual cover to cover? :-)

"Ray reads the manual so we wont have too." LOL :lol:

You're 'The Man!'
Lance Short
"infinite diversity in infinite combinations"
***
"The absence of evidence is not evidence of absence."
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

It's probably true that I read the manuals and readme files more thoroughly than most; that's because I have to be prepared to teach this stuff, and answer questions (or at least know where to look). Being able to quote page numbers impresses folk, too. 8)
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
srekant
Premium Member
Premium Member
Posts: 85
Joined: Wed Jan 19, 2005 6:52 am
Location: Detroit

works

Post by srekant »

Code: Select all

Doesnt Work! -->mydate= 'May  1 1995 12:00:00.000 AM'
if u want the above part to work use a convert function to convert all the spaces to 0 and then apply the functions

Code: Select all

DateToString(StringToDate(mydate[1,11],"%mmm %dd %yyyy"),"%yyyy%mm%dd") on the converted datecolumn
.[/code]
Sree
srekant
Premium Member
Premium Member
Posts: 85
Joined: Wed Jan 19, 2005 6:52 am
Location: Detroit

Problem with timeatamp

Post by srekant »

i used the same code mentioned by INFO_DS

(

Code: Select all

mydate= 'May 12 1995 12:00:00.000 AM' 

DateToString(StringToDate(mydate[1,11],"%mmm %dd %yyyy"),"%yyyy%mm%dd")) 
it is working fine on soalris machine.But when imoved the same code to Pre production environement (HP-UNIX) i am getting the following error

Item #: 4

Code: Select all

Event ID: 3
   Timestamp: 2005-06-28 00:16:02
   Type: Info
   User Name: dsadm
   Message: Advanced runtime options used:  -default_timestamp_format "%yyyy-%mm-%dd\u %hh:%nn:%ss" 

Item #: 7
   Event ID: 6
   Timestamp: 2005-06-28 00:16:03
   Type: Fatal
   User Name: dsadm
   Message: main_program: When unescaping string %yyyy-%mm-%dd\u and error occured.
does anyone encountered this error
Sree
Lali_swam
Participant
Posts: 39
Joined: Thu May 05, 2005 3:39 am
Location: Bangalore
Contact:

Re: yeah i also tried out and is working fine thanks guys.

Post by Lali_swam »

Hi,
Can we use ICONV and OCONV for these date conversions???

if the data is Jan 12 1995
then the result would be

ICONV("12 Jan 1995","D4-DMY[2,A3,4"]>=0
OCONV(0,"D4 YDM[4,2,2]">= 1995 1 12

Hope this helps.
Lalitha
Lalitha
srekant
Premium Member
Premium Member
Posts: 85
Joined: Wed Jan 19, 2005 6:52 am
Location: Detroit

Re: yeah i also tried out and is working fine thanks guys.

Post by srekant »

Lali_swam wrote:Hi,
Can we use ICONV and OCONV for these date conversions???

if the data is Jan 12 1995
then the result would be

ICONV("12 Jan 1995","D4-DMY[2,A3,4"]>=0
OCONV(0,"D4 YDM[4,2,2]">= 1995 1 12

Hope this helps.
Lalitha
ICONV and OCONV are used in server jobs not in parallel jobs
Sree
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Is the default timestamp format different on the other machine? (You can view this using the Administrator client, Parallel tab in the project properties.)
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Post Reply