Java Today today()

Here you can find the source of today()

Description

today

License

Open Source License

Declaration

public static Date today() 

Method Source Code

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

import java.text.ParseException;
import java.text.SimpleDateFormat;

import java.util.Date;

public class Main {
    public final static String webFormat = "yyyy-MM-dd";

    public static Date today() {
        return parse(format(new Date(), webFormat), webFormat);
    }/*w  ww  . ja v a2s  . c om*/

    public static Date parse(String s_date, String format) {
        if (s_date == null)
            return null;
        try {
            return new SimpleDateFormat(format).parse(s_date);
        } catch (ParseException e) {
            e.printStackTrace();
        }
        return null;
    }

    public static String format(Date date, String format) {
        if (date == null) {
            return null;
        }

        return new SimpleDateFormat(format).format(date);
    }
}

Related

  1. today()
  2. today()
  3. today()
  4. today()
  5. toDay()
  6. today()
  7. today()
  8. today()
  9. Today()