Java Timestamp Create createTimestampedZipFilename(String prefix)

Here you can find the source of createTimestampedZipFilename(String prefix)

Description

create Timestamped Zip Filename

License

Open Source License

Declaration

public static String createTimestampedZipFilename(String prefix) 

Method Source Code


//package com.java2s;
import java.text.SimpleDateFormat;
import java.util.Date;

public class Main {
    private final static ThreadLocal<SimpleDateFormat> DATE_FORMATTER = new ThreadLocal<SimpleDateFormat>() {
        @Override// w ww .java2  s .  c o m
        protected SimpleDateFormat initialValue() {
            return new SimpleDateFormat("yyyyMMddHHmmss");
        }
    };

    public static String createTimestampedZipFilename(String prefix) {
        StringBuilder sb = new StringBuilder(prefix);
        sb.append("-");
        sb.append(DATE_FORMATTER.get().format(new Date()));
        sb.append(".zip");
        return sb.toString();
    }
}

Related

  1. createTimeStamp()
  2. createTimeStamp()
  3. createTimestamp(final int aYear, final int aMonth, final int aDate, final int aHour, final int aMinute, final int aSecond)
  4. createTimestamp(final int year, final int month, final int day, final int hour, final int minute, final int second)
  5. createTimestamp(int month, int day)
  6. createTimestampFormat()
  7. createTimeStamps()
  8. getTimestamp()
  9. getTimestamp()