Java Day of getTimestamp(String format, Integer daysInFuture)

Here you can find the source of getTimestamp(String format, Integer daysInFuture)

Description

get Timestamp

License

Open Source License

Declaration

public static String getTimestamp(String format, Integer daysInFuture) 

Method Source Code


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

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

public class Main {
    public static String getTimestamp(String format, Integer daysInFuture) {
        Calendar c = Calendar.getInstance();
        if (daysInFuture != null)
            c.add(Calendar.DAY_OF_YEAR, daysInFuture);
        return new SimpleDateFormat(format).format(c.getTime());
    }/*from w ww  .j  a v  a  2s  .c o  m*/

    public static String getTimestamp() {
        return getTimestamp("yyyyMMddHHmmss", null);
    }
}

Related

  1. getStringDay(Calendar cal)
  2. getTargetDay(String day, int beforeOrAfterDays)
  3. getTheDayBefore(Date date)
  4. getThursday(String date)
  5. getTimeOfDaySeconds()
  6. getTwoDay(String sj1, String sj2)
  7. getTwoDay(String sj1, String sj2)
  8. getTwoDay2String(String startDate, String endDate, Format format)
  9. getWorkingDay(Calendar d1, Calendar d2)