Java Time Format getSysDateTimeForFileName()

Here you can find the source of getSysDateTimeForFileName()

Description

get Sys Date Time For File Name

License

Open Source License

Exception

Parameter Description
Exception if error

Return

String for match with file name

Declaration

public static String getSysDateTimeForFileName() throws Exception 

Method Source Code

//package com.java2s;
/*//from w ww.  j  a va 2 s .c  om
 * Copyright (C) 2010 Viettel Telecom. All rights reserved.
 * VIETTEL PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
 */

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

public class Main {
    /**
     *
     * @return String for match with file name
     * @throws Exception if error
     */
    public static String getSysDateTimeForFileName() throws Exception {
        Calendar calendar = Calendar.getInstance();
        SimpleDateFormat dateFormat = new SimpleDateFormat("dd_MM_yyyy_HH_mm");
        try {
            return dateFormat.format(calendar.getTime());
        } catch (Exception e) {
            throw e;
        }
    }
}

Related

  1. getStartTimeFormatter()
  2. getStrDateByFormat(Date time, String format)
  3. getStrDateTime()
  4. getStringFormatFromDateTime(long pDateTime, String format)
  5. getStringFromTime(Date time, String format)
  6. getSysTimeYMDHMS2()
  7. getTime(@Nonnull String format, @Nonnull String date, @Nonnull String tz)
  8. getTime(Date dt, String format)
  9. getTime(Date time, int format, Locale locale)