Java Timestamp Create toSQLTime(Instant timestamp)

Here you can find the source of toSQLTime(Instant timestamp)

Description

Convert EPICS time stamp into SQL time stamp

License

Open Source License

Parameter

Parameter Description
timestamp Instant

Declaration

public static java.sql.Timestamp toSQLTime(Instant timestamp) 

Method Source Code

//package com.java2s;
/*******************************************************************************
 * Copyright (c) 2012 Oak Ridge National Laboratory.
 *  All rights reserved. This program and the accompanying materials
 *  are made available under the terms of the Eclipse Public License v1.0
 *  which accompanies this distribution, and is available at
 *  http://www.eclipse.org/legal/epl-v10.html
 ******************************************************************************/

import java.time.Instant;

public class Main {
    /** Convert EPICS time stamp into SQL time stamp
     *  @param timestamp {@link Instant}
     *  @return {@link java.sql.Timestamp}
     *//* ww w . ja v a 2  s. c om*/
    public static java.sql.Timestamp toSQLTime(Instant timestamp) {
        final java.sql.Timestamp sql = new java.sql.Timestamp(timestamp.toEpochMilli());
        sql.setNanos(timestamp.getNano());
        return sql;
    }
}

Related

  1. timestampNonce(final int length)
  2. timestampNow()
  3. timestampStartOfDay(long time)
  4. timestampStringToUnixDate(String s)
  5. toOracleTimestamp(String stringDate, int intFlag)
  6. toSqlTime(Timestamp timestamp)
  7. toSqlTimestamp(Date d)
  8. toSqlTimeStamp(Date d)
  9. toSQLTimestamp(Date date)