N78A
7 years agoContributor
Converting value of timestamp to expected format - groovy Soapui
I am trying to convert value of timestamp fetched from hive database to an expected format. Can some one please help !
Timestamp fetched :
TRANSACTION_TIMESTAMP>20170210141809</TRANSACTION_TIMESTAMP
Required format:
2017-02-10 14:18:
Code to fetch from xml for further operation:
String timeStamp1 = results1[i].get("transactionTimeStamp")
// 'results1[i].get' is written to bring all the timestamps from xml as there are multiple instances of timestamp in the xml.
Now I found below but dont know how to use this in my code to first convert fetched value to date & then convert to desired format
def now = new Date()
println now.format("YYYYMMdd-HH:mm:ss")