code: private void applyAutoTimestamp(PropertyMetadata propertyMetadata, long millis) {
      Object timestamp = null;
      Class<?> fieldType = propertyMetadata.getDeclaredType();
      if (Date.class.equals(fieldType)) {
        timestamp = new Date(millis);
      } else if (Calendar.class.equals(fieldType)) {
        Calendar calendar = new Calendar.Builder().setInstant(millis).build();
        timestamp = calendar;
      } else if (Long.class.equals(fieldType) || long.class.equals(fieldType)) {
        timestamp = millis;
      } else if (OffsetDateTime.class.equals(fieldType)) {
        timestamp = OffsetDateTime.ofInstant(Instant.ofEpochMilli(millis), ZoneId.systemDefault());
      } else if (ZonedDateTime.class.equals(fieldType)) {
        timestamp = ZonedDateTime.ofInstant(Instant.ofEpochMilli(millis), ZoneId.systemDefault());
      }
      ValueBuilder<?, ?, ?> valueBuilder = propertyMetadata.getMapper().toDatastore(timestamp);
      valueBuilder.setExcludeFromIndexes(!propertyMetadata.isIndexed());
      entityBuilder.set(propertyMetadata.getMappedName(), valueBuilder.build());
    }
docs: Applies the given time, <code>millis</code>, to the property represented by the given metadata.
  
  @param propertyMetadata
  the property metadata of the field
  @param millis
  the time in milliseconds