Here you can find the source of getCurrentISODate()
public static String getCurrentISODate()
//package com.java2s; //License from project: Open Source License import java.time.Instant; import java.time.OffsetDateTime; import java.time.ZoneId; import java.time.format.DateTimeFormatter; public class Main { /** ISO DATE format. It's used in ePub generator. */ private static final DateTimeFormatter ISO_DATE = DateTimeFormatter.ofPattern("yyyy-MM-dd'T'HH:mm:ssZ"); public static String getCurrentISODate() { return ms2OffsetDateTime(System.currentTimeMillis()).format(ISO_DATE); }//from w w w . j a va2s . c o m /** * ms -> OffsetDateTime object. * @param ms millisecond * @return LocalDateTime */ public static OffsetDateTime ms2OffsetDateTime(final long ms) { return OffsetDateTime.ofInstant(Instant.ofEpochMilli(ms), ZoneId.systemDefault()); } }