cancel
Showing results for 
Search instead for 
Did you mean: 

Date Time conversion

former_member237514
Participant
0 Kudos

Hi All,

i am getting below error using date transformation function.

Client expected :2016-01-01T00:00:00-08:00

same format i maintain in graphical mapping level below is the screen shot

but when i test the total scenario with sample data i am getting below error .

Plz give some suggestions ASAP.

Thanks

Kavitha

Accepted Solutions (1)

Accepted Solutions (1)

iaki_vila
Active Contributor
0 Kudos

Hi Kavi,

The S symbol is used for milliseconds, have you checked this blog ?

Regards,

Answers (6)

Answers (6)

former_member237514
Participant
0 Kudos

Thanks for all for your suggestions

former_member186851
Active Contributor
0 Kudos

It worked Kavitha??

Please post the solution.

former_member237514
Participant
0 Kudos

Actually we mapped to wrong field so that field format is dd-mm-yyyy.

So now we Mapped to correct field so that filed format is YYYYMMDD.

And client said they don't want timezone along with date so.i sent only date now its working .

Thanks for help.

GauravKant
Contributor
0 Kudos

Hi Kavitha,

please try using below UDF . have attached output screenshot also.

please check if it is feasible for you.

i am wondering why X timezone is not working with UDF, while same is working in eclipse.

Code:

try{

String D=var1;

DateFormat converter = new SimpleDateFormat("dd-MM-yyyy");

Date dt=(Date)converter.parse(D);

DateFormat converter1 = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssZ:00");

converter1.setTimeZone(TimeZone.getTimeZone("PST"));

D=converter1.format(dt);

return D;

}

catch(ParseException e)

{

e.printStackTrace();

}

return null;

Mapping:

Output:

former_member237514
Participant
0 Kudos

Any suggestions plz

manoj_khavatkopp
Active Contributor
0 Kudos

Check this below one :

Br,

Manoj

former_member237514
Participant
0 Kudos

Hi Manoj,

Thanks for shearing UDF.

But When i used that above UDF i am getting error like below screen shot .

But when i checked in Message mapping level UDF is working but when i test total scenario i am getting that error.

former_member186851
Active Contributor
0 Kudos

This is not because of UDF I guess

manoj_khavatkopp
Active Contributor
0 Kudos

The error you are getting because web service is not accepting the date format which you are sending , so can you firstly try with SOAP UI and then do the required modification in mapping.

Additionally what i see is your source is and standard idoc MATMAS , and standard IDOC Date format is YYYYMMDD , are you really getting dd-mm-yyyy as the format ?

former_member237514
Participant
0 Kudos

Hi Manoj,

Actually we mapped to wrong field so that field format is dd-mm-yyyy.

So know we Mapped to correct field so that filed format is YYYYMMDD.

And client said they don't want timezone along with date so.i sent only date now its working .

Thanks for help.

former_member237514
Participant
0 Kudos

Hi All,

Any suggestion plz.

former_member186851
Active Contributor
0 Kudos

Hello Kavitha,

Typicall That should work,Why don't try using a small UDF.

You can take Engg blog as reference.

former_member237514
Participant
0 Kudos

Hi Raghu,

I am very poor in Java codeing,

From Engg Blog my requirement is 1st option.even i maintain same but still not get exactly.

Can you plz provide sample udf for that.

former_member186851
Active Contributor
0 Kudos

Hello Kavitha,

As I told I dont have any system now to try the code.

Lets wait for other experts comment.

former_member190293
Active Contributor
0 Kudos

Hi Kavi!

Take a look at 's blog.

I guess that standard function "DateTrans" doesn't support your output date format.

Try with output format like yyyy-MM-dd'T'HH:mm:ss Z.

Regards, Evgeniy.

Former Member
0 Kudos

HI Kavitha,

please change your data type for "ValidFrom" field from string to Date and try.

Regards,
Bhavin Parmar

former_member237514
Participant
0 Kudos

Hi Bhavin,

In sender and receiver side structure i can able to see the data type as "String" for  "ValidFrom" field.

Below is the screen shot fyi,

Plz check end let me know any suggestions

Thanks

Kavitha

former_member186851
Active Contributor
0 Kudos

Hello Kavitha,

Try with the patterns as per the below link

SimpleDateFormat (Java Platform SE 7 )

former_member237514
Participant
0 Kudos

Hello Raghu,

I gone through the link which you provide earlier .

here i have one more doubt

Target excepting :1900-01-01T00:00:00-08:00

In mapping level  I applied  this syntax format  "yyMMddHHmmssZ"  010704120856-0700

i got the output like   2016-07-20T00:00:00+0000.

But here end of the of the date i need  +00:00 like this.

Can you help me this .how to get .

Thanks

Kavitha

former_member186851
Active Contributor
0 Kudos

Hello Kavitha,

You dont need + 0.00 right?

Try like below

yyyy-MM-dd'T'HH:mm:ss.SS


Where SS stands for milliseconds ,you can add one more S if you wish to have 3 digit millisecond value.

former_member237514
Participant
0 Kudos

Hi Raghu,

kindly find the below screenshot

I tried with adding X format Date also but i got error.

former_member186851
Active Contributor
0 Kudos

Hello Kavitha,

Post the exact format required.

You need to add timezone or milliseconds.

former_member237514
Participant
0 Kudos

Client expected :2016-01-01T00:00:00-08:00


in that client requirement end of the digits(-08:00) regarding Timezone.


so i need time zone formate


I got upto   2016-07-20T00:00:00+0000 but end of the digits (+0000) i need to put semicolon like +00:00


so plz suggest me how to do that


former_member186851
Active Contributor
0 Kudos

Hello Kavitha,

Try either of the the below

yyyy-MM-dd'T'HH:mm:ss.SSSZ  

yyyy-MM-dd'T'HH:mm:ss.SSSXXX

former_member237514
Participant
0 Kudos

Hello Raghu,

I tried with your inputs

yyyy-MM-dd'T'HH:mm:ss.SSSZ  for this output  2016-07-20T00:00:00.000+0000



yyyy-MM-dd'T'HH:mm:ss.SSSXXX for this output i am getting error like below screen shot.


former_member186851
Active Contributor
0 Kudos

Hello Kavitha,

XXX is only to get timezone with Semicolon,

Can you post the screenshot with input and outputs.

former_member237514
Participant
0 Kudos

plz see the below screen shot

former_member186851
Active Contributor
0 Kudos

Try with a space between SSS and XXX.

former_member237514
Participant
0 Kudos

No luck its not working throwing same error

former_member186851
Active Contributor
0 Kudos

Strange.I dont have system to try.

Try with single X..

former_member237514
Participant
0 Kudos

no it's not working same error only