Java Timestamp Create getTimestamp2()

Here you can find the source of getTimestamp2()

Description

get Timestamp

License

Apache License

Declaration

public static Timestamp getTimestamp2() 

Method Source Code

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

import java.sql.Timestamp;
import java.text.DateFormat;

import java.text.SimpleDateFormat;

import java.util.Date;

public class Main {
    public static Timestamp getTimestamp2() {
        Date dt = new Date();
        DateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        String nowTime = df.format(dt);
        java.sql.Timestamp buydate = java.sql.Timestamp.valueOf(nowTime);
        return buydate;
    }//from  w  ww. j  av a2 s.co m
}

Related

  1. getTimestamp(String sqlDateTime)
  2. getTimestamp(String Str)
  3. getTimestamp(String str)
  4. getTimestamp(String strDate)
  5. getTimestamp(String time, String pattern)
  6. getTimeStampAsString(Timestamp formatTime)
  7. getTimestampAsString(Timestamp tsTimestamp)
  8. getTimestampAtMidnightForDaysAgo(int days)
  9. getTimestampBeforeMs(long someMs)