Java SQL Date Format dateFromLong(Long longObject)

Here you can find the source of dateFromLong(Long longObject)

Description

Answer a Date from a long This implementation is based on the java.sql.Date class, not java.util.Date.

License

Open Source License

Parameter

Parameter Description
longObject - milliseconds from the epoch (00:00:00 GMT Jan 1, 1970). Negative values represent dates prior to the epoch.

Declaration

public static java.sql.Date dateFromLong(Long longObject) 

Method Source Code

//package com.java2s;
/*******************************************************************************
 * Copyright (c) 1998, 2015 Oracle and/or its affiliates. All rights reserved.
 * This program and the accompanying materials are made available under the
 * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0
 * which accompanies this distribution./*  w  ww  .j  a  v  a 2s . c  om*/
 * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
 * and the Eclipse Distribution License is available at
 * http://www.eclipse.org/org/documents/edl-v10.php.
 *
 * Contributors:
 *     Oracle - initial API and implementation from Oracle TopLink
 *     dminsky - added countOccurrencesOf(Object, List) API
 *     08/23/2010-2.2 Michael O'Brien
 *        - 323043: application.xml module ordering may cause weaving not to occur causing an NPE.
 *                       warn if expected "_persistence_*_vh" method not found
 *                       instead of throwing NPE during deploy validation.
 ******************************************************************************/

public class Main {
    /**
     * Answer a Date from a long
     *
     * This implementation is based on the java.sql.Date class, not java.util.Date.
     * @param longObject - milliseconds from the epoch (00:00:00 GMT
     * Jan 1, 1970).  Negative values represent dates prior to the epoch.
     */
    public static java.sql.Date dateFromLong(Long longObject) {
        return new java.sql.Date(longObject.longValue());
    }
}

Related

  1. dateFormat(Object obj, String parten)
  2. dateFormat(String sdate, String format)
  3. dateFormatJson(Date date)
  4. formataData(Date data)
  5. formatAsText(ResultSet result_set, PrintWriter out)
  6. formatBytableCols(Object[] obj, String[] tableCols)
  7. formatDate(java.util.Date uDate)