Here you can find the source of formatDate(Date tagValue)
private static String formatDate(Date tagValue)
//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); } }