Java Timestamp timestampOf(final ZonedDateTime time)

Here you can find the source of timestampOf(final ZonedDateTime time)

Description

Gets Timestamp for ZonedDateTime.

License

Apache License

Parameter

Parameter Description
time Time object to be converted.

Return

Timestamp representing time

Declaration

public static Timestamp timestampOf(final ZonedDateTime time) 

Method Source Code

//package com.java2s;
//License from project: Apache License 

import java.sql.Timestamp;
import java.time.Instant;

import java.time.ZonedDateTime;

public class Main {
    /**//from w w  w. jav a 2 s  .  c  o  m
     * Gets Timestamp for ZonedDateTime.
     *
     * @param time Time object to be converted.
     * @return Timestamp representing time
     */
    public static Timestamp timestampOf(final ZonedDateTime time) {
        return timestampOf(time.toInstant());
    }

    /**
     * Gets Timestamp for Instant.
     *
     * @param time Time object to be converted.
     * @return Timestamp representing time
     */
    private static Timestamp timestampOf(final Instant time) {
        return Timestamp.from(time);
    }
}

Related

  1. timestampIntToTimestamp(long timestampInt)
  2. timestampIsEquals(Timestamp timestamp1, Timestamp timestamp2)
  3. TimeStampMonthDayYear(Timestamp timestamp)
  4. timestampNow()
  5. TimestampNow()
  6. timestampPlusDay(java.sql.Timestamp ts, int iDayPlus)
  7. timestampPlusDay2DDMMYYYY(java.sql.Timestamp ts, int iDayPlus)
  8. trunc(Timestamp dayTime, String trunc)
  9. truncateFractionalSeconds(Timestamp timestamp)