Groovy代码import javatimeLocalDateString ret = 2023-08-18String tmp = 30LocalDate date = LocalDateparseretdate = dateplusDaystmptoIntegerString outputDate = datetoStringreturn outputDate想return 回去日期怎么写
您可以使用以下代码将日期格式化为指定的字符串并返回:
import java.time.LocalDate import java.time.format.DateTimeFormatter
String ret = "2023-08-18" String tmp = "30"
LocalDate date = LocalDate.parse(ret) date = date.plusDays(tmp.toInteger())
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd") String outputDate = date.format(formatter)
return outputDate
原文地址: https://www.cveoy.top/t/topic/iHBh 著作权归作者所有。请勿转载和采集!