将LocalDate设置为当前日期-
LocalDate date = LocalDate.now();
在UTC中转换为java.util.Date-
Date.from(date.atStartOfDay().toInstant(ZoneOffset.UTC))
import java.time.LocalDate; import java.time.ZoneOffset; import java.util.Date; public class Demo { public static void main(String[] args) { LocalDate date = LocalDate.now(); System.out.println("Date = "+date); System.out.println("Date (UTC) = "+Date.from(date.atStartOfDay().toInstant(ZoneOffset.UTC))); } }
输出结果
Date = 2019-04-19 Date (UTC) = Fri Apr 19 05:30:00 IST 2019