Java Timestamp Format formatTimestamp(Date timestamp)

Here you can find the source of formatTimestamp(Date timestamp)

Description

format Timestamp

License

Open Source License

Declaration

public static String formatTimestamp(Date timestamp) 

Method Source Code


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

import java.text.DateFormat;

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

public class Main {
    private static final TimeZone UTC = TimeZone.getTimeZone("UTC");
    private static final String DATE_TIME_FORMAT = "yyyy-MM-dd'T'HH:mm:ss'Z'";

    public static String formatTimestamp(Date timestamp) {
        DateFormat format = new SimpleDateFormat(DATE_TIME_FORMAT);
        format.setCalendar(new GregorianCalendar(UTC));
        return format.format(timestamp);
    }/*from  www  . ja  va  2  s  .  c o m*/
}

Related

  1. formatTime(Timestamp ts, Locale locale)
  2. formatTimeFromTimestamp(long ts, String fmt)
  3. formatTimestamp(Date date)
  4. formatTimestamp(Date timestamp)
  5. formatTimestamp(Date timestamp)
  6. formatTimestamp(final Date date)
  7. formatTimestamp(final Long timestamp)
  8. formatTimeStamp(long epochTime)
  9. formatTimestamp(Long mills)