Java code snippet no longer working to create dates in 3.3.2, worked fine in 3.3.1 and prior builds
- 5 years ago
The custom property worked perfectly! Let me ask one more thing. With the old java, I could modify the dates such as:
Same Day
${=import javax.xml.datatype.DatatypeFactory; def cal = Calendar.instance;cal.getTime().format("MM/dd/yyyy")}Future Date
${=import javax.xml.datatype.DatatypeFactory; def cal = Calendar.instance;cal.add(Calendar.DATE, 1000);cal.getTime().format("MM/dd/yyyy")}Is that possible using the SimpleDate snippets?
- 5 years ago
1) Future date custom property with Local Date class:
${= import java.time.LocalDate; LocalDate.now().plusDays(1).format(java.time.format.DateTimeFormatter.ofPattern("MM/dd/yyyy"))}
or
${=java.time.LocalDateTime.now().plusDays(1).format(java.time.format.DateTimeFormatter.ofPattern("MM/dd/yyyy"))}
2) Future Date in groovy with Simple Date Format:
import groovy.time.TimeCategory
import java.text.SimpleDateFormatuse(TimeCategory) {
def time = new Date()+ 1.days
date = new SimpleDateFormat ("MM/dd/yyyy").format(time)}