2 Replies Latest reply on Oct 27, 2021 4:55 AM by Suvam Pani

    Wrong datetime format

    Sai Ram Active Member

      I got a DateTime format in the wrong way 2021-03-10- Need to correct it in Expression editor as 2021-03 10-17:32:15.000000 in cloud application integration. can someone help

        • 1. Re: Wrong datetime format
          Willi Tanura New Member

          Maybe you can try something like below:


          infa:format($dt,"yyyy-mm-dd'T'HH:mm:ss", "yyyy-mm dd-'T'HH:mm:ss")

          Here, $dt is the datetime variable.

          • 2. Re: Wrong datetime format
            Suvam Pani Active Member

            Hi Sai,


            From CAI (Cloud Application Integration) perspective, neither 2021-03-10- nor 2021-03 10-17:32:15.000000 seem like valid dateTime format (CAI uses this format: yyyy-mm-ddThh:mm:ss.sssZ, example: 2021-10-27T11:40:48.425Z).


            Hence, we can consider this query as formatting one string to another. We can use the following XQuery expression in CAI:

            let $inp:= '2021-03-10-'

            let $split1 := fn:tokenize($inp, '-')

            let $split2 := fn:tokenize($split1[4], '\.')

            return $split1[1]||'-'||$split1[2]||' '||$split1[3]||'-'||$split2[1]||':'||$split2[2]||':'||$split2[3]||'.'||$split2[4]


            Output: 2021-03 10-17:32:15.000000


            fn:tokenize() splits a string based on the separator, and double pipe operator is used for concatenation.