Java Timestamp Format timeStampForFileName(final String simpleDateFormat)

Here you can find the source of timeStampForFileName(final String simpleDateFormat)

Description

time Stamp For File Name

License

Open Source License

Declaration

public static String timeStampForFileName(final String simpleDateFormat) 

Method Source Code

//package com.java2s;

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

public class Main {

    public static String timeStampForFileName() {
        return timeStampForFileName("yyyy-MM-dd_HH-mm");
    }/*from w  w w.java  2 s . c om*/

    public static String timeStampForFileName(final String simpleDateFormat) {
        Date currentDateTime = new Date(System.currentTimeMillis());
        SimpleDateFormat humanReadableFormat = new SimpleDateFormat(simpleDateFormat);
        return humanReadableFormat.format(currentDateTime);
    }
}

Related

  1. Timestamp2DDMMYYYY(java.sql.Timestamp ts)
  2. Timestamp2HHMMSS(java.sql.Timestamp ts, int iStyle)
  3. timestamp2String(long source, DateFormat format)
  4. Timestamp2UTC(Timestamp mytime)
  5. timestampConvertToString(int timeStamp, String format)
  6. timestampFormat(Date date)
  7. timestampFormat(final Date date)
  8. timeStampFormat(Timestamp t)
  9. timestampToFormattedDate(Long timestamp)