Java Timestamp Now nowTimestamp()

Here you can find the source of nowTimestamp()

Description

now Timestamp

License

Open Source License

Declaration

public static Timestamp nowTimestamp() 

Method Source Code

//package com.java2s;
/*******************************************************************************
 * Educational Online Test Delivery System 
 * Copyright (c) 2014 American Institutes for Research
 *   // w w  w.  jav  a2 s  .  co m
 * Distributed under the AIR Open Source License, Version 1.0 
 * See accompanying file AIR-License-1_0.txt or at
 * http://www.smarterapp.org/documents/American_Institutes_for_Research_Open_Source_Software_License.pdf
 ******************************************************************************/

import java.sql.Timestamp;

public class Main {
    public static Timestamp nowTimestamp() {
        Long now = System.nanoTime();
        Timestamp value = new Timestamp(now / 1_000_000L);
        value.setNanos(Long.valueOf(now % 1_000_000_000L).intValue());
        return value;
    }
}

Related

  1. getTimestamp()
  2. getTimeStamp()
  3. getTimestamp()
  4. getTimestamp()
  5. isCurrentDataByStartdataAndEnddata(Timestamp startDate, Timestamp endDate)
  6. nowTimestamp()
  7. nowTimestamp()
  8. nowTimestamp()