Java Date Format formatDate(Date tagValue)

Here you can find the source of formatDate(Date tagValue)

Description

format Date

License

Apache License

Declaration

private static String formatDate(Date tagValue) 

Method Source Code

//package com.java2s;
//License from project: Apache 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 ThreadLocal<DateFormat> timestampFormat = ThreadLocal.withInitial(() -> {
        // Z-normalized RFC 3339 format
        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss");
        GregorianCalendar calendar = new GregorianCalendar(TimeZone.getTimeZone("UTC"));
        calendar.setGregorianChange(new Date(Long.MIN_VALUE));
        sdf.setCalendar(calendar);// w w w. ja  v a  2 s  .co m
        return sdf;
    });

    private static String formatDate(Date tagValue) {
        return timestampFormat.get().format(tagValue);
    }
}

Related

  1. formatDate(Date fecha)
  2. formatDate(Date in)
  3. formatDate(Date myDate)
  4. formatDate(Date pDate, boolean pShowDateOnly)
  5. formatDate(Date t)
  6. formatDate(Date value)
  7. formatDate(Date value)
  8. formatDate(DateFormat format, Date date)
  9. formatDate(final Calendar cal)