Java Long Number to Date formatDateISO(long millis)

Here you can find the source of formatDateISO(long millis)

Description

format Date ISO

License

Open Source License

Declaration

public static String formatDateISO(long millis) 

Method Source Code

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

import java.text.SimpleDateFormat;

import java.util.Date;

public class Main {
    private static final String ISO_FORMAT_SECONDS = "yyyy-MM-dd'T'HH:mm:ss'Z'";
    private static final SimpleDateFormat isoFormat = new SimpleDateFormat();

    public static String formatDateISO(long millis) {
        Date d = new Date();
        d.setTime(millis);//from   w w w.  j ava  2  s . co  m
        return formatDateISO(d);
    }

    public synchronized static String formatDateISO(Date date) {
        if (date == null) {
            return null;
        }
        isoFormat.applyPattern(ISO_FORMAT_SECONDS);
        return isoFormat.format(date);
    }
}

Related

  1. formatDateForLog(long dateTs)
  2. formatDateHeader(final long date)
  3. formatDateHeader(final long date)
  4. formatDateHeader(long millis)
  5. formatDateHeader(long value)
  6. formatDateTime(long d)
  7. formatDateTime(long d)
  8. formatDateTime(long date)
  9. formatDateTime(long millis)