Java Today today()

Here you can find the source of today()

Description

today

License

LGPL

Declaration

public static Date today() 

Method Source Code

//package com.java2s;
//License from project: LGPL 

import java.util.*;

public class Main {
    /**//from   w w w. ja  v  a 2s.c  om
     * Milliseconds=14 *
     */
    public static final int MILLISECOND = Calendar.MILLISECOND;
    /**
     * Seconds=13 *
     */
    public static final int SECOND = Calendar.SECOND;
    /**
     * Minute=12 *
     */
    public static final int MINUTE = Calendar.MINUTE;
    /**
     * Hour=11 *
     */
    public static final int HOUR = Calendar.HOUR_OF_DAY;

    public static Date today() {
        final Calendar calendar = Calendar.getInstance();
        calendar.setTime(new Date());
        // zero time (hour, minutes, seconds, milliseconds)
        calendar.set(Calendar.HOUR, 0);
        calendar.set(Calendar.MINUTE, 0);
        calendar.set(Calendar.SECOND, 0);
        calendar.set(Calendar.MILLISECOND, 0);
        return calendar.getTime();
    }
}

Related

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