Forum Discussion
In case anyone is looking for examples in the future, I had several date formats I needed to test with. Below are the examples:
Current yyyy/mm/dd
${=import javax.xml.datatype.DatatypeFactory; def cal = Calendar.instance;cal.getTime().format("yyyy-MM-dd'T'HH:mm:ss")}
Current mm/dd/yyyy
${=import javax.xml.datatype.DatatypeFactory; def cal = Calendar.instance;cal.getTime().format("MM/dd/yyyy")}
Current mm/dd/yyyy Plus 1 Day
${=import javax.xml.datatype.DatatypeFactory; def cal = Calendar.instance;cal.add(Calendar.DATE, 1);cal.getTime().format("MM/dd/yyyy")}
Current mm-dd-yyyy Plus 1 Day
${=import javax.xml.datatype.DatatypeFactory; def cal = Calendar.instance;cal.add(Calendar.DATE, 1);cal.getTime().format("MM-dd-yyyy")}
Current mm/dd/yyyy Plus 1 Day with Timestamp
${=import javax.xml.datatype.DatatypeFactory; def cal = Calendar.instance;cal.add(Calendar.DATE, 1);cal.getTime().format("MM/dd/yyyy'T'HH:mm:ss")}
Well.
No need for such big expressions, which can be simplified as below(applicable for all of them)
Change from:
${=import javax.xml.datatype.DatatypeFactory; def cal = Calendar.instance;cal.getTime().format("yyyy-MM-dd
To
${=new Date().format("yyyy-MM-dd'T'HH:mm:ss")}
- CByler7 years agoContributor
I was just trying to give back to the community. Way to make me rethink that...
Related Content
- 2 years agoTestQA1
- 5 years agoKrishna_Kumar
- 3 years agoloricotton