Java Date UTC Format FormatAsUtc(Date date)

Here you can find the source of FormatAsUtc(Date date)

Description

Format As Utc

License

Open Source License

Declaration

public static String FormatAsUtc(Date date) 

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 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);
    }//ww  w  . jav  a 2s .c  o  m
}

Related

  1. createUTCDateFormatter(String dateFormat)
  2. formatAsUTC(java.util.Date date, String pattern)
  3. formatDate(Date date, String pattern, boolean toUTC)
  4. formatTimeStamp(byte[] btValue, int iOffset, int iLength, int iUtcOffset)
  5. formatUTC(Date date, String format)