Hi Aditya,

There's no direct way to manipulate date-time using Data Mapper. But since
it flows as strings, you can do the following transformation using string
manipulations (sub-string)

Input:

{
"From": "2017-03-17T00:00:00",
 "To": "2018-03-16T00:00:00"
}


output

{
"From": "2017-03-17",
 "To": "2018-03-16"
}

But if you want to manipulate date-time further, you will have to write a
custom data mapper function as Himasha mentioned.

Thanks,


On Thu, Jan 11, 2018 at 4:55 PM, Himasha Guruge <[email protected]> wrote:

> Hi Aditya,
>
> Could you please try with a custom function in data-mapper? Please
> refer[1] for more information.
>
> [1] http://chathurikaerandi.blogspot.com/2016/07/custom-
> function-and-global-variables-in.html
>
> Thanks,
> Himasha
>
> On Wed, Jan 10, 2018 at 6:40 PM, aditya shivankar <
> [email protected]> wrote:
>
>> Respected Sir,
>>
>> I am getting dates as string in input.
>>
>> {
>> "From": "2017-03-17T00:00:00",
>>  "To": "2018-03-16T00:00:00"
>> }
>>
>>
>> need to convert them to mm/dd/yyyy format.
>>
>> expected output :
>> {
>> "From": "03/17/2017",
>>  "To": "03/16/2018"
>> }
>>
>> I cannot use xslt mediator here as I am already facing issues with this
>> xslt mediator,
>> I am not able to configure and use xslt to transform json messages.
>>
>> With Regards,
>> Aditya
>>
>>
>> _______________________________________________
>> Dev mailing list
>> [email protected]
>> http://wso2.org/cgi-bin/mailman/listinfo/dev
>>
>>
>
>
> --
> Himasha Guruge
> Senior Software Engineer
> WS*O2* *Inc.*
> Mobile: +94 777459299 <+94%2077%20745%209299>
> [email protected]
>
> _______________________________________________
> Dev mailing list
> [email protected]
> http://wso2.org/cgi-bin/mailman/listinfo/dev
>
>


-- 
*Eranda Rajapakshe*
Software Engineer
WSO2 Inc.
Mobile : +94784822608
_______________________________________________
Dev mailing list
[email protected]
http://wso2.org/cgi-bin/mailman/listinfo/dev

Reply via email to