public synchronized String toString(Calendar cal, Timestamp x) { return toString(cal, x, true); }
public synchronized String toString(Calendar cal, Date x) { return toString(cal, x, true); }
public synchronized String toString(Calendar cal, Time x) { return toString(cal, x, true); }
/** * Returns the given time value as String matching what the current postgresql server would send * in text mode. * * @param time time value * @param withTimeZone whether timezone should be added * @return given time value as String */ public String timeToString(java.util.Date time, boolean withTimeZone) { Calendar cal = null; if (withTimeZone) { cal = calendarWithUserTz; cal.setTimeZone(timeZoneProvider.get()); } if (time instanceof Timestamp) { return toString(cal, (Timestamp) time, withTimeZone); } if (time instanceof Time) { return toString(cal, (Time) time, withTimeZone); } return toString(cal, (Date) time, withTimeZone); }
private void setDate(int i, LocalDate localDate) throws SQLException { int oid = Oid.DATE; bindString(i, connection.getTimestampUtils().toString(localDate), oid); }
private void setTime(int i, LocalTime localTime) throws SQLException { int oid = Oid.TIME; bindString(i, connection.getTimestampUtils().toString(localTime), oid); }
private void setTimestamp(int i, OffsetDateTime offsetDateTime) throws SQLException { int oid = Oid.TIMESTAMPTZ; bindString(i, connection.getTimestampUtils().toString(offsetDateTime), oid); } //JCP! endif
private void setTimestamp(int i, LocalDateTime localDateTime) throws SQLException { int oid = Oid.TIMESTAMP; bindString(i, connection.getTimestampUtils().toString(localDateTime), oid); }
/** * Formats {@link LocalDateTime} to be sent to the backend, thus it adds time zone. * Do not use this method in {@link java.sql.ResultSet#getString(int)} * @param localDateTime The local date to format as a String * @return The formatted local date */ public synchronized String toString(LocalDateTime localDateTime) { if (localDateTime.isAfter(MAX_LOCAL_DATETIME)) { return "infinity"; } else if (LocalDateTime.MIN.equals(localDateTime)) { return "-infinity"; } // LocalDateTime is always passed with time zone so backend can decide between timestamp and timestamptz ZonedDateTime zonedDateTime = localDateTime.atZone(getDefaultTz().toZoneId()); return toString(zonedDateTime.toOffsetDateTime()); }
rowBuffer[columnIndex] = connection .encodeString( connection.getTimestampUtils().toString( getDefaultCalendar(), (Date) valueObject)); break; rowBuffer[columnIndex] = connection .encodeString( connection.getTimestampUtils().toString( getDefaultCalendar(), (Time) valueObject)); break; connection.getTimestampUtils().toString( getDefaultCalendar(), (Timestamp) valueObject)); break;
public void setTime(int i, Time t, java.util.Calendar cal) throws SQLException { checkClosed(); if (t == null) { setNull(i, Types.TIME); return; } int oid = Oid.UNSPECIFIED; // If a PGTime is used, we can define the OID explicitly. if (t instanceof PGTime) { PGTime pgTime = (PGTime) t; if (pgTime.getCalendar() == null) { oid = Oid.TIME; } else { oid = Oid.TIMETZ; cal = pgTime.getCalendar(); } } if (cal == null) { cal = getDefaultCalendar(); } bindString(i, connection.getTimestampUtils().toString(cal, t), oid); }
cal = getDefaultCalendar(); bindString(i, connection.getTimestampUtils().toString(cal, d), Oid.UNSPECIFIED);
cal = getDefaultCalendar(); bindString(i, connection.getTimestampUtils().toString(cal, t), oid);
sb.append(postgresBaseConnection.getTimestampUtils().toString(null, tmpd)); } else {