Java UTC Date getUtcTimestamp()

Here you can find the source of getUtcTimestamp()

Description

Request timestamp in ISO 8601 combined date and time in UTC.

License

Open Source License

Return

String timestamp Example: 2014-09-18T10:32:59Z

Declaration

public static String getUtcTimestamp() 

Method Source Code

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

import java.text.SimpleDateFormat;
import java.util.*;

public class Main {
    /**//from  w ww .j  av a 2  s .com
     * Request timestamp in ISO 8601 combined date and time in UTC.
     *
     * @return String timestamp Example: 2014-09-18T10:32:59Z
     */
    public static String getUtcTimestamp() {
        SimpleDateFormat timeFormatter = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'");
        timeFormatter.setTimeZone(new SimpleTimeZone(SimpleTimeZone.UTC_TIME, "UTC"));
        return timeFormatter.format(new Date());
    }
}

Related

  1. GetUtcNow()
  2. getUTCTime()
  3. getUTCTime()
  4. getUTCTime(final Date inDate)
  5. getUtcTimestamp()
  6. getUTCTimestamp(Date date)
  7. getUtcTimestampAsString(Date date)
  8. getUTCTimeString4Digits(Date date)
  9. nowInUTC()