Java Date Now getCurrentTimeForName()

Here you can find the source of getCurrentTimeForName()

Description

Gets current date (for random name of new item)

License

Open Source License

Return

current date in yyMMdd_HHmmss format

Declaration

public static String getCurrentTimeForName() 

Method Source Code

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

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

public class Main {
    /**/*from ww  w .  j av a2  s  .com*/
     * Gets current date (for random name of new item)
     *
     * @return current date in yyMMdd_HHmmss format
     */
    public static String getCurrentTimeForName() {
        SimpleDateFormat f = new SimpleDateFormat("yyMMddHHmmss_");
        return f.format(Calendar.getInstance().getTime());
    }
}

Related

  1. getCurrentTimeAndDate()
  2. getCurrentTimeAsNumber()
  3. getCurrentTimeAsString()
  4. getCurrentTimeForFileName()
  5. getCurrentTimeForLog()
  6. getCurrentTimeForUseInAFileName()
  7. getCurrentTimeInMySqlTime()
  8. getCurrentTimeInMySqlTime()
  9. getCurrentTimeInString(SimpleDateFormat dateFormat)