Returns the property value as a Timestamp.

@throws DatastoreException if no such property
@throws ClassCastException if value is not a Timestamp
12115
@SuppressWarnings("unchecked")
  public Timestamp getTimestamp(String name) {
    return ((Value<Timestamp>) getValue(name)).get();
  }
128956
def convert_timestamps(obj):
    
    for key in ('date', 'when', 'end', 'start_date', 'end_date'):
        value = obj.get(key)
        if value:
            try:
                obj[key] = _timestamp_to_dt(value)
            except TypeError:
                raise TypeError("expected float for %s, got %s" % (key, value))

    for key in ('sources', 'actions', 'votes', 'roles'):
        for child in obj.get(key, []):
            convert_timestamps(child)

    return obj
996974
@Override
	public Timestamp getTimestamp(final String columnLabel, final Calendar cal) throws SQLException {
		return wrapped.getTimestamp(columnLabel, cal);
	}
1247023
private boolean isTypeTimestampConvertible(final Field field) {
        return dataTypes.entrySet().stream()
                .anyMatch(e -> e.getValue().equals("TIMESTAMP") && e.getKey().equals(field.getType()));
    }
780571
@Override
	public Long serialize(Calendar value) {
		if (value != null) {
			return value.getTimeInMillis();
		}
		return null;
	}
1059327
public function getTimestamp(): int
    {
        $supportedClasses = implode(
            ', ',
            [
                '\MongoTimestamp',
                '\MongoDate',
                '\MongoDB\BSON\Timestamp',
                '\MongoDB\BSON\UTCDateTime',
                '\DateTimeInterface',
            ]
        );

        if (!$this->t || !is_object($this->t)) {
            throw new \DomainException(
                'The timestamp to normalise must be one of ' . $supportedClasses . ' but it is not an object'
            );
        }

        switch (get_class($this->t)) {
            case 'MongoTimestamp':
                return (int) $this->t->__toString();

            case 'MongoDate':
                return $this->t->sec;

            case 'MongoDB\BSON\Timestamp':
                return $this->t->getTimestamp();

            case 'MongoDB\BSON\UTCDateTime':
                return (int) $this->t->toDateTime()->format('U');
        }

        if ($this->t instanceof \DateTimeInterface) {
            return $this->t->getTimestamp();
        }

        throw new \DomainException(
            'The normalised timestamp must be one of ' . $supportedClasses
        );
    }
526059
@Deprecated
    public static Object getRSVal(ResultSet rs, int idx) throws SQLException {
        Object o = rs.getObject(idx);

        // oracle timestamps are not always convertible to a java Date. If ResultSet.getTimestamp is used instead of
        // ResultSet.getObject, a normal java.sql.Timestamp instance is returnd.
        if (o != null && FeatureDetector.isOracleAvailable() && o.getClass().getCanonicalName().startsWith("oracle.sql.TIMESTAMP")){
            o = rs.getTimestamp(idx);
        }

        return o;
    }
745382
public static Timestamp generateTimestamp() {
		Instant time = Instant.now();
		Timestamp timestamp = Timestamp.newBuilder().setSeconds(time.getEpochSecond())
				.setNanos(time.getNano()).build();
		return timestamp;
	}
428280
private Timestamp convertFieldValueToTimestamp(final Field field,
                                                   final ExportContainer exportContainer) {
        if (field.getType().equals(LocalDateTime.class)) {
            return convertToTimestamp(parseDateTime(exportContainer.getExportValue()));
        } else if (field.getType().equals(LocalDate.class)) {
            return convertToTimestamp(parseDate(exportContainer.getExportValue()));
        } else if (field.getType().equals(LocalTime.class)) {
            return convertToTimestamp(parseTime(exportContainer.getExportValue()));
        } else if (field.getType().equals(Date.class)) {
            return convertToTimestamp(parseSimpleDateLong(exportContainer.getExportValue()));
        } else if (field.getType().equals(Timestamp.class)) {
            return Timestamp.valueOf(exportContainer.getExportValue());
        }
        return null;
    }
188832
@Override
    public Timestamp getTimestamp(String parameterName, Calendar cal) throws SQLException
    {
        checkClosed();
        throw SQLError.noSupport();
    }
765915
public RowBuilder timestampCol(String name)
  {
    Column column = new ColumnTimestamp(_columns.size(), name, _offset);
    
    _offset += column.length();
    _columns.add(column);
    
    return this;
  }
5750
def _serialize(self, value, attr, obj, **kwargs):
        """"""
        if value is None:
            return None

        return int(datetime_to_timestamp(value))
808012
@Override
	public Long serialize(Date value) {
		if (value != null) {
			return value.getTime();
		}
		return null;
	}
649472
@Override
    public Time getTime(int parameterIndex, Calendar cal) throws SQLException
    {
        checkClosed();
        throw SQLError.noSupport();
    }
494625
private String formatTimestamp(String value) {
        try {
            long longValue = Long.parseLong(value);
            return Utils.formatDate(longValue);
        } catch (NumberFormatException e) {
            return "Invalid timestamp: " + value; 
        }
    }
1090824
def is_timestamp(obj):
    
    return isinstance(obj, datetime.datetime) or is_string(obj) or is_int(obj) or is_float(obj)
1270902
@VisibleForTesting
  static Timestamp convertTimestamp(io.opencensus.common.Timestamp censusTimestamp) {
    if (censusTimestamp.getSeconds() < 0) {
      // StackDriver doesn't handle negative timestamps.
      return Timestamp.newBuilder().build();
    }
    return Timestamp.newBuilder()
        .setSeconds(censusTimestamp.getSeconds())
        .setNanos(censusTimestamp.getNanos())
        .build();
  }