on 11-17-2011 1:37 PM
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 ?
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
84 | |
10 | |
10 | |
9 | |
7 | |
6 | |
5 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.