Answers for "how to get utc datetime java"

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 "Java"

Java Answers by Framework

Browse Popular Code Answers by Language