Java Timestamp Convert To toEPICSTime(java.sql.Timestamp timestamp)

Here you can find the source of toEPICSTime(java.sql.Timestamp timestamp)

Description

Convert SQL time stamp into EPICS time stamp

License

Open Source License

Parameter

Parameter Description

Declaration

public static Instant toEPICSTime(java.sql.Timestamp 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 SQL time stamp into EPICS time stamp
     *  @param timestamp{@link java.sql.Timestamp}
     *  @return {@link Instant}/*from ww w .jav  a  2 s  .co m*/
     */
    public static Instant toEPICSTime(java.sql.Timestamp timestamp) {
        return Instant.ofEpochSecond(timestamp.getTime() / 1000L, timestamp.getNanos());
    }
}

Related

  1. toDate(Timestamp timestamp)
  2. toDateTime(Timestamp value)
  3. toDecimal(Timestamp instant)
  4. toEnglishDateTime(java.sql.Timestamp ts)
  5. toEnglishHours(java.sql.Timestamp ts)
  6. toFormatedString(final Timestamp ts, final String timeZoneId)
  7. toGmtTimestampString(Timestamp timestamp)
  8. toInstant(final Timestamp timestamp)
  9. toJavaDate(Timestamp dt)