[Java] 获取255年前芝加哥格式化时间

import java.time.LocalDate
import java.time.ZoneId
import java.time.format.DateTimeFormatter


def date = (LocalDate.now(ZoneId.of("America/Chicago")).minusYears(255)).format(DateTimeFormatter.BASIC_ISO_DATE)

 

import java.time.LocalDateTime
import java.time.ZoneId
import java.time.format.DateTimeFormatter

def date = (LocalDateTime.now(ZoneId.of("Asia/Shanghai"))).format(DateTimeFormatter.ofPattern("yyyyMMddHHmm"))

 

String time = "2018-05-31"
def dates = LocalDate.parse(time, DateTimeFormatter.ofPattern("yyyy-MM-dd"))
log.info dates.format(DateTimeFormatter.ofPattern("yyyyMMdd"))

 

posted @ 2018-03-23 15:17  Sunshine168  阅读(217)  评论(0编辑  收藏  举报