Java Timestamp Create getTimestamp()

Here you can find the source of getTimestamp()

Description

get Timestamp

License

Apache License

Declaration

public static String getTimestamp() 

Method Source Code

//package com.java2s;
//License from project: Apache License 

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

import java.util.TimeZone;

public class Main {
    public static String getTimestamp() {
        final Date date = new Date();
        final String ISO_FORMAT = "yyyy-MM-dd'T'HH:mm:ssz";
        final SimpleDateFormat sdf = new SimpleDateFormat(ISO_FORMAT);
        final TimeZone utc = TimeZone.getTimeZone("UTC");
        sdf.setTimeZone(utc);//from   w w  w.  j  a va2s .  c  om
        String timeStamp = sdf.format(date);
        return timeStamp.replace("UTC", "Z");
    }
}

Related

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