Java Timestamp Now nowTimestamp()

Here you can find the source of nowTimestamp()

Description

Return a Timestamp for right now

License

Apache License

Return

Timestamp for right now

Declaration

public static java.sql.Timestamp nowTimestamp() 

Method Source Code


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

import java.sql.Timestamp;

public class Main {
    /**//  www  . j  a  v  a2  s .  c om
     * Return a Timestamp for right now
     *
     * @return Timestamp for right now
     */
    public static java.sql.Timestamp nowTimestamp() {
        return getTimestamp(System.currentTimeMillis());
    }

    /**
     * Convert a millisecond value to a Timestamp.
     * @param time millsecond value
     * @return Timestamp
     */
    public static java.sql.Timestamp getTimestamp(long time) {
        return new java.sql.Timestamp(time);
    }

    /**
     * Convert a millisecond value to a Timestamp.
     * @param milliSecs millsecond value
     * @return Timestamp
     */
    public static Timestamp getTimestamp(String milliSecs) throws NumberFormatException {
        return new Timestamp(Long.parseLong(milliSecs));
    }
}

Related

  1. getTimestamp()
  2. isCurrentDataByStartdataAndEnddata(Timestamp startDate, Timestamp endDate)
  3. nowTimestamp()
  4. nowTimestamp()
  5. nowTimestamp()