on 03-08-2021 11:59 AM
Hi,
I need to convert unix datetime to yyyy-MM-dd in SAP CPI message mapping preferably or a groovy script.
My Input xml is -
<?xml version="1.0" encoding="UTF-8"?> <root> <record> <value1>1615204493000</value1> <value2>1515204493000</value2> </record> </root>
My Output xml is -
<?xml version="1.0" encoding="UTF-8"?> <root> <record> <value1>2021-03-08</value1> <value2>2018-01-06</value2> </record> </root>
Can you please let me know how can we achieve it.
Regards
Hi vijayant.jha2,
The following code is working in Grrovy Playground. Kindly adapt this as per your integration flow:
import java.text.SimpleDateFormat
def dateUnix = 1615204493000
Date dateObj = new Date(((long)dateUnix))
def cleanDate = new SimpleDateFormat('yyyy-MM-dd').format(dateObj)
println "clean date $cleanDate"
Regards,
Sunny
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Kindly upvote, if solution works for you
User | Count |
---|---|
72 | |
8 | |
8 | |
6 | |
6 | |
6 | |
5 | |
5 | |
5 | |
5 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.