Java Timestamp Create getTimestamp()

Here you can find the source of getTimestamp()

Description

get Timestamp

License

Open Source License

Declaration

private static String getTimestamp() 

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.TimeZone;

public class Main {
    private static final ThreadLocal<DateFormat> dfs = new ThreadLocal<DateFormat>();

    private static String getTimestamp() {
        DateFormat df = dfs.get();
        if (df == null) {
            TimeZone tz = TimeZone.getTimeZone("UTC");
            df = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'");
            df.setTimeZone(tz);/* w  w  w  . ja  v a  2  s  . c o m*/
            dfs.set(df);
        }
        return df.format(new Date());
    }
}

Related

  1. getTimestamp()
  2. getTimestamp()
  3. getTimestamp()
  4. getTimestamp()
  5. getTimeStamp()
  6. getTimeStamp()
  7. getTimeStamp()
  8. getTimestamp()
  9. getTimestamp()