Java SQL Date Create getCurrentDateWithMinutePrecision()

Here you can find the source of getCurrentDateWithMinutePrecision()

Description

Gets the current date with minute precision.

License

Apache License

Return

the current date time with seconds and milliseconds rounded down

Declaration

public static Timestamp getCurrentDateWithMinutePrecision() 

Method Source Code


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

import java.sql.Timestamp;

import java.util.Calendar;

import java.util.GregorianCalendar;

public class Main {
    /**//from  w  w  w .ja v  a2 s.  com
     * Gets the current date with minute precision.
     * 
     * @return the current date time with seconds and milliseconds rounded down
     */
    public static Timestamp getCurrentDateWithMinutePrecision() {

        Calendar c = new GregorianCalendar();
        c.set(Calendar.SECOND, 0);
        c.set(Calendar.MILLISECOND, 0);

        Timestamp ts = new Timestamp(c.getTimeInMillis());

        return ts;
    }
}

Related

  1. getCurrentDate()
  2. getCurrentDate()
  3. getCurrentDateStart()
  4. getCurrentDateStr(String strFormat)
  5. getCurrentDateString()
  6. getCurrentDayStartDate(Date date)
  7. getCurrentDBDate()
  8. getCurrentSQLDate()
  9. getCurSQLDate()