Android UTC Get nowUTC()

Here you can find the source of nowUTC()

Description

now UTC

License

Open Source License

Return

- Long version of time.

Declaration

public static long nowUTC() 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

import java.util.Calendar;

import java.util.TimeZone;

public class Main {
    /**/*from w w w. jav a  2  s  .  c o  m*/
     * @return - Long version of time.
     */
    public static long nowUTC() {

        Calendar calendar = Calendar.getInstance();
        TimeZone timeZone = calendar.getTimeZone();

        long currentTime = System.currentTimeMillis();
        int offsetWithUTC = timeZone.getOffset(currentTime);
        long utcTime = currentTime - offsetWithUTC;

        return utcTime;

    }
}

Related

  1. nowUTCString()