package com.bh.test
import java.time.Instant
import java.time.LocalDate
import java.time.LocalDateTime
import java.time.LocalTime
import java.time.OffsetDateTime
import java.time.format.DateTimeFormatter
public class Test {
public Test() {
LocalTime localTime=LocalTime.now()
System.out.println("LocalTime:"+localTime)
LocalDate localDate=LocalDate.now()
System.out.println("LocalDate:"+localDate)
LocalDateTime localDateTime=LocalDateTime.now()
System.out.println("LocalDateTime:"+localDateTime)
Instant instant = Instant.now()
System.out.println(instant)
OffsetDateTime offsetDT = OffsetDateTime.now()
System.out.println("OffsetDateTime:"+offsetDT)
//DateTimeFormatter f = DateTimeFormatter.ISO_LOCAL_DATE_TIME
//DateTimeFormatter f = DateTimeFormatter.ISO_DATE_TIME
//DateTimeFormatter f = DateTimeFormatter.ofLocalizedDate(FormatStyle.FULL)
//DateTimeFormatter f = DateTimeFormatter.ofLocalizedDate(FormatStyle.LONG)
//DateTimeFormatter f = DateTimeFormatter.ofLocalizedDate(FormatStyle.MEDIUM)
//DateTimeFormatter f = DateTimeFormatter.ofLocalizedDate(FormatStyle.SHORT)
//DateTimeFormatter f = DateTimeFormatter.ofPattern("YYYY年MM月dd日 EE HH:mm:ss")
//DateTimeFormatter f = DateTimeFormatter.ofPattern("YYYY-MM-dd EE HH:mm:ss")
//DateTimeFormatter f = DateTimeFormatter.ofPattern("YYYY-MM-dd EE HH:mm:ss a")
DateTimeFormatter f = DateTimeFormatter.ofPattern("YYYY-MM-dd EE HH:mm:ss.SSS")
LocalDateTime date = LocalDateTime.now()
String str =f.format(date)
System.out.println(str)
}
public static void main(String[] args) {
new Test()
}
}