简体   繁体   中英

How to format the date field in WSO2 EI Rest API

I want to format the Date field from a WSo2 EI REST API currently i am getting the response in the below format.

{
    "Members": {
        "member": [
            {
                "First_Name": "FLORENCE       ",
                "Effective_Date": "2019-05-01-07:00"
}]}}

But I want the response to be like

                "Effective_Date": "2019-05-01"

I tried with "Effective_Date":"$effective_date(type:dateTime, 'YYYY-MM-DD')"

<config id="DataSource"> 
    <property name="jndi_resource_name">jdbc/datasourcename</property>
</config> 
<query id="get_new_touchMembers" useConfig="DataSource"> 
    <sql>EXECUTE databasename..SP_NAME</sql> 
    <result outputType="json"> {
     "Members":{ "member":[ { "S.NO":"$s.NO", "ID":"$id", "DOB":"$dob", "Effective_Date":"$effective_date", "Term_Date":"$term_date", "Plan_Description":"$plan_description" } ] } } </result> 
</query>

Try this property as it works for me!

<property expression="get-property('SYSTEM_DATE', 'yyyy-MM-dd')" name="effective_date" scope="default"/>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM