List of usage examples for java.sql Timestamp Timestamp
public Timestamp(long time)
From source file:Main.java
public static String getDateTime(long t) { Timestamp timestamp = new Timestamp(t / 1000000); //make it miliseconds from nanoseconds return timestamp.toString(); }
From source file:Main.java
public static Timestamp dateToSQLTimestamp(java.util.Date d) { return d != null ? new Timestamp(d.getTime()) : null; }
From source file:Main.java
public static String getSysDate() { return new Timestamp(System.currentTimeMillis()).toString().substring(0, 10); }
From source file:Main.java
public static Timestamp now() { return new Timestamp(System.currentTimeMillis()); }
From source file:Main.java
public static Timestamp getSysTimestamp() { return new Timestamp(System.currentTimeMillis()); }
From source file:Main.java
public static String getYYYY_MM_dd() { Timestamp ts = new Timestamp(System.currentTimeMillis()); long timestamp = ts.getTime(); SimpleDateFormat formater = new SimpleDateFormat("yyyy.MM.dd hh:mm:ss"); String strTime = formater.format(timestamp); return strTime; }
From source file:Main.java
public static long getTimestamp(String time) { time = time + ":00"; Timestamp ts = new Timestamp(System.currentTimeMillis()); try {/*from w ww . j a v a 2 s.co m*/ ts = Timestamp.valueOf(time); } catch (Exception e) { e.printStackTrace(); } return ts.getTime(); }
From source file:Main.java
public static Timestamp getNowTimestamp() { long curTime = System.currentTimeMillis(); return new Timestamp(curTime); }
From source file:Main.java
public static String getYear_Second1() { Timestamp stamp1 = new Timestamp(System.currentTimeMillis()); SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); String timeStr = sdf.format(stamp1); return timeStr; }
From source file:Main.java
public static String getSeconds2() { java.util.Date date1 = new java.util.Date(); Timestamp stamp2 = new Timestamp(date1.getTime()); return stamp2.toString(); }