Java Time Now currentTimedDate()

Here you can find the source of currentTimedDate()

Description

Get the current date and time in sting form

License

Open Source License

Return

the current date and time as a string

Declaration

public static String currentTimedDate() 

Method Source Code


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

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

public class Main {
    private static final String DATE_FORMAT_NOW = "yyyy-MM-dd HH:mm:ss";

    /**//from   w w  w.  j a va 2  s .co  m
     * Get the current date and time in sting form
     * 
     * @return the current date and time as a string
     */
    public static String currentTimedDate() {
        Calendar cal = Calendar.getInstance();
        SimpleDateFormat sdf = new SimpleDateFormat(DATE_FORMAT_NOW);
        return sdf.format(cal.getTime());
    }
}

Related

  1. currentTime()
  2. currentTime()
  3. currentTime()
  4. currentTime()
  5. currentTime()
  6. currentTimeMillis()
  7. currentTimePath(String basePath)
  8. currentTimeStr()
  9. currentTimeString()