Java Timestamp Create getTimestamp(int offset)

Here you can find the source of getTimestamp(int offset)

Description

get Timestamp

License

Apache License

Declaration

public static String getTimestamp(int offset) 

Method Source Code

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

import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.TimeZone;

public class Main {
    public static String getTimestamp(int offset) {
        Calendar cal = Calendar.getInstance();
        cal.add(Calendar.MINUTE, offset);

        SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm'Z'");
        formatter.setTimeZone(TimeZone.getTimeZone("GMT"));

        return formatter.format(cal.getTime());
    }/*w  w  w .j ava 2s . co m*/
}

Related

  1. getTimestamp(Date date, String timestampPattern)
  2. getTimestamp(Date time)
  3. getTimestamp(final File file)
  4. getTimestamp(final LocalDate date)
  5. getTimestamp(final Map map, final Object key)
  6. getTimestamp(int year, int month, int day, int hour, int min, int second)
  7. getTimestamp(java.util.Date utilDate)
  8. getTimestamp(long time)
  9. getTimestamp(Object o)