Java SQL Date Get getDate(Date value)

Here you can find the source of getDate(Date value)

Description

Gets the date.

License

Open Source License

Parameter

Parameter Description
value the value

Return

the date

Declaration

public static long getDate(Date value) 

Method Source Code

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

import java.sql.Timestamp;

import java.util.Date;

public class Main {
    /**/*w  w  w. j a v  a 2  s  .com*/
     * Gets the date.
     *
     * @param value
     *            the value
     * 
     * @return the date
     */
    public static long getDate(Date value) {
        return value == null ? -1 : value.getTime();
    }

    /**
     * Gets the date.
     *
     * @param value
     *            the value
     * 
     * @return the date
     */
    public static Date getDate(long value) {
        return value > 0 ? new Date(value) : null;
    }

    /**
     * Gets the date.
     *
     * @param date
     *            the date
     * 
     * @return the date
     */
    public static Date getDate(Timestamp date) {
        return date == null ? null : new Date(date.getTime());
    }
}

Related

  1. getDate()
  2. getDate()
  3. getDate()
  4. getDate(Calendar pCal)
  5. getDate(Date date)
  6. getDate(final int year, final int month, final int day)
  7. getDate(final String value)
  8. getDate(Map m, String key)
  9. getDate(Object object)