Java UTC Date GetUtcNow()

Here you can find the source of GetUtcNow()

Description

Get Utc Now

License

Open Source License

Declaration

public static String GetUtcNow() 

Method Source Code


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

import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.TimeZone;

public class Main {
    public static String GetUtcNow() {
        return FormatAsUtc(new Date());
    }/* w  w w . j  av a2 s. c  om*/

    public static String FormatAsUtc(Date date) {
        SimpleDateFormat f = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'");
        f.setTimeZone(TimeZone.getTimeZone("UTC"));
        return f.format(date);
    }
}

Related

  1. getUtcDate(String date, String pattern)
  2. getUTCDateFromString(String date)
  3. getUtcDateString()
  4. getUtcDateStringFromTimestamp(Date timeStamp)
  5. GetUTCdatetimeAsString()
  6. getUTCTime()
  7. getUTCTime()
  8. getUTCTime(final Date inDate)
  9. getUtcTimestamp()