Java Date to Timestamp dateToTimestamp(Date date)

Here you can find the source of dateToTimestamp(Date date)

Description

useful for webservice because we can not use java.sql.date in wsdl

License

Open Source License

Parameter

Parameter Description
date a parameter

Declaration

public static Timestamp dateToTimestamp(Date date) 

Method Source Code

//package com.java2s;
/*******************************************************************************
 * This file is part of ISPyB./*from ww w  .  java 2s  .co m*/
 * 
 * ISPyB is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Lesser General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 * 
 * ISPyB is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU Lesser General Public License for more details.
 * 
 * You should have received a copy of the GNU Lesser General Public License
 * along with ISPyB.  If not, see <http://www.gnu.org/licenses/>.
 * 
 * Contributors : S. Delageniere, R. Leal, L. Launer, K. Levik, S. Veyrier, P. Brenchereau, M. Bodin, A. De Maria Antolinos
 ******************************************************************************/

import java.sql.Timestamp;

import java.util.Date;

public class Main {
    /**
     * useful for webservice because we can not use java.sql.date in wsdl
     * 
     * @param date
     * @return
     */
    public static Timestamp dateToTimestamp(Date date) {
        if (date == null)
            return null;
        java.sql.Timestamp stamp = new Timestamp(date.getTime());
        return stamp;
    }
}

Related

  1. compareDate(String timeStamp1, String timeStamp2)
  2. dateToTimestamp(Date date)
  3. dateToTimestamp(Date date)
  4. dateToTimestamp(Date date)
  5. dateToTimestamp(Date date)