Java Date Now getCurrentDateTime()

Here you can find the source of getCurrentDateTime()

Description

get Current Date Time

License

Open Source License

Declaration

public static String getCurrentDateTime() 

Method Source Code

//package com.java2s;

import java.text.SimpleDateFormat;

import java.util.Date;

public class Main {

    public static String getCurrentDateTime() {
        Date d = new Date();
        SimpleDateFormat df = new SimpleDateFormat();
        df.applyPattern("yyyy/MM/dd HH:mm:ss");
        return df.format(d);
    }/*ww  w  . j a  v a 2s  . c o m*/

    public static String getCurrentDateTime(boolean WithDelimeter) {
        if (WithDelimeter)
            return new SimpleDateFormat("yyyy/MM/dd HH:mm:ss").format(new Date());
        return new SimpleDateFormat("yyyyMMddHHmmss").format(new Date());
    }
}

Related

  1. getCurrentDateString()
  2. getCurrentDateString(String dateFormat)
  3. getCurrentDateString(String format)
  4. getCurrentDateTime()
  5. getCurrentDateTime()
  6. getCurrentDateTime()
  7. getCurrentDateTime()
  8. getCurrentDateTime()
  9. getCurrentDateTime()