List of usage examples for java.sql Timestamp getTime
public long getTime()
From source file:Main.java
public static java.util.Date sqlTimestampToDate(Timestamp t) { return t != null ? new java.util.Date(Math.round((double) t.getTime() + (double) t.getNanos() / 1000000D)) : null;/* w w w . jav a 2s .com*/ }
From source file:Main.java
public static ZonedDateTime getDateTime(Timestamp timestamp) { return timestamp != null ? ZonedDateTime.ofInstant(Instant.ofEpochMilli(timestamp.getTime()), ZoneOffset.UTC) : null;/*w w w .j a va 2s. c o m*/ }
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 Timestamp subtractTimeZoneOffset(Timestamp timestamp, TimeZone timeZone) { final long millisecondsToSubtract = Math.abs(timeZone.getOffset(timestamp.getTime())); return new Timestamp(timestamp.getTime() - millisecondsToSubtract); }
From source file:gobblin.data.management.retention.sql.SqlUdfs.java
/** * Returns a value after subtracting a {@link Timestamp} from another. Value is in the {@link TimeUnit} provided in * <code>unit</code> string. * * @param timestamp1 first {@link Timestamp} * @param timestamp2 second {@link Timestamp} * @param unit for the difference. Any {@link TimeUnit#values()} are supported units. * @return// w w w . j a v a 2s .c om */ public static long timestamp_diff(Timestamp timestamp1, Timestamp timestamp2, String unit) { return date_diff(timestamp1.getTime(), timestamp2.getTime(), unit); }
From source file:com.dc.gameserver.extComponents.Kit.DateUtil.java
@SuppressWarnings("deprecation") public static int getDiffDay(Timestamp time1, Timestamp time2) { return getDay1(new Date(time2.getTime()), new Date(time1.getTime())); }
From source file:com.erbjuder.logger.client.logmessage.util.LoggerToProxyObjects.java
public static XMLGregorianCalendar long2Gregorian(Timestamp timeStamp) { return date2Gregorian(new Date(timeStamp.getTime())); }
From source file:infowall.domain.persistence.sql.ItemValueDao.java
private static DateTime toDateTime(Timestamp ts) { return new DateTime(ts.getTime()); }
From source file:com.bitranger.parknshop.task.OrderChecker.java
private static Timestamp subtract(Timestamp left, Timestamp right) { return new Timestamp(left.getTime() - right.getTime()); }
From source file:Main.java
public static XMLGregorianCalendar timestampToXMLGregorianCalendar(Timestamp t) { if (t == null) { return null; }//from w ww . j a v a 2 s. co m GregorianCalendar gc = new GregorianCalendar(); gc.setTimeInMillis(t.getTime()); try { return DatatypeFactory.newInstance().newXMLGregorianCalendar(gc); } catch (DatatypeConfigurationException ex) { return null; } }