Answers for "get current utc time in java mkyong"

1

java get date in utc

OffsetDateTime now = OffsetDateTime.now(ZoneOffset.UTC);
System.out.println(now);
Posted by: Guest on July-08-2020
0

java get date in utc

private static Date getCurrentUtcTime() throws ParseException {
    SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MMM-dd HH:mm:ss");
    simpleDateFormat.setTimeZone(TimeZone.getTimeZone("UTC"));
    SimpleDateFormat localDateFormat = new SimpleDateFormat("yyyy-MMM-dd HH:mm:ss");
    return localDateFormat.parse( simpleDateFormat.format(new Date()) );
}
Posted by: Guest on July-08-2020

Code answers related to "get current utc time in java mkyong"

Code answers related to "Java"

Java Answers by Framework

Browse Popular Code Answers by Language