Java Now now()

Here you can find the source of now()

Description

now

License

Open Source License

Declaration

public static String now() 

Method Source Code

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

import java.text.SimpleDateFormat;

import java.util.Date;

public class Main {
    public static String now() {
        return formatTime(today());
    }/*from w w  w.  j a  v  a 2  s .c  o m*/

    public static String formatTime(Date date) {
        String dateString = date.toString();
        SimpleDateFormat formatter = new SimpleDateFormat("yyyyMMddHHmm");
        try {
            dateString = formatter.format(date);
        } catch (IllegalArgumentException iae) {
            iae.printStackTrace();
        }
        return dateString;
    }

    public static Date today() {
        return new Date();
    }
}

Related

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