cancel
Showing results for 
Search instead for 
Did you mean: 

Help with DateTrans function YYYY-MM-DDTHH:MM:SS.sssZ

Former Member
0 Kudos

I am trying to map a datetime field supplied by a call from Sybase Unwired Platform.

It is sending the date as format 2011-11-15T15:10:13.944Z and I am trying to use the Datetrans function to convert to the 20111115 required by an IDOC date field.

I am using

yyyy-dd-MMTHH:mm:ss.SSS

as the input format but it fails with runtime error Illegal pattern character 'T'

Can anyone help ?

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

hi,

Use the standard function "DateTrans", and see mainly this Java help, you will know exactly all the possibilities:

be careful on lowercase and ippercase, because the mean is different !

[http://java.sun.com/j2se/1.5.0/docs/api/java/text/SimpleDateFormat.html] (really good, )

[http://java.sun.com/j2se/1.5.0/docs/api/java/util/Date.html]

[http://java.sun.com/j2se/1.5.0/docs/api/java/text/DateFormat.html]

Example: (not yours)

yyyy.MM.dd G 'at' HH:mm:ss z --> 2001.07.04 AD at 12:08:56 PDT

so with a text 'at'...

I'm sure you will have yours. Enjoy play.

regards.

Mickael

Answers (3)

Answers (3)

Former Member
0 Kudos

Thank you all

Mickael's link gave me the answer in needed.

I Used the dateTrans function with input format yyyy-MM-dd'T'HH:mm:ss.SSS'Z' and it converted beautifully.

Paul

baskar_gopalakrishnan2
Active Contributor
0 Kudos

Here is the udf to achieve this

create a udf function with input as parameter and pass the date string and return as string

Signature Variable

Type Argument    Name input  JavaType String

public String datesString(String input, Container container) throws StreamTransformationException{

	String input = "2011-11-15T15:10:13.944Z ";
	String parseDateString = input.substring(0,10);
	StringBuffer output = new StringBuffer().append(parseDateString.substring(0,4))
                                                               .append(parseDateString.substring(5,7))
                                                               .append(parseDateString.substring(8,10));
			
                         return output.toString();

}

Edited by: Baskar Gopal on Nov 17, 2011 9:36 AM

Shabarish_Nair
Active Contributor
0 Kudos

with the standard datetrans function, i dont think the format YYYY-MM-DDTHH:MM:SS.sssZ is supported.

you might have to write a simple UDF to help you out here for the date conversion.