Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;

import java.util.Calendar;

import java.util.Locale;
import java.util.TimeZone;

public class Main {
    public static Long GetUTCTime() {
        Calendar cal = Calendar.getInstance(TimeZone.getDefault(), Locale.getDefault());
        int zoneOffset = cal.get(Calendar.ZONE_OFFSET);
        int dstOffset = cal.get(Calendar.DST_OFFSET);
        cal.add(java.util.Calendar.MILLISECOND, -(zoneOffset + dstOffset));
        return cal.getTimeInMillis();
    }
}