Java Now now()

Here you can find the source of now()

Description

Get today's date.

License

Open Source License

Return

String that respresents the current date

Declaration

public static String now() 

Method Source Code


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

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

public class Main {
    /**//w  w w.j av  a  2s  . c om
     * Get today's date.
     * @return String that respresents the current date
     */
    public static String now() {
        Calendar cal = Calendar.getInstance();
        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        return sdf.format(cal.getTime());
    }
}

Related

  1. now()
  2. now()
  3. now()
  4. now()
  5. now()
  6. now()
  7. now()
  8. Now()
  9. now()