Custom entities created time is always the same I have a custom content entity type. When I create an instance, the first one got the right created time stamp. But starting with the second one, they all have the same created time stamp: as the first one have!

Why is this happening?

Base field definition:

$fields['created'] = BaseFieldDefinition::create('created')
  -&gt;setLabel(t('Created'))
  -&gt;setDescription(t('The time that the entity was created.'))
  -&gt;setReadOnly(TRUE)
  -&gt;setDisplayConfigurable('view', TRUE);


Setter / getter methods:

  /**
   * {@inheritdoc}
   */
  public function getCreatedTime() {
    return $this-&gt;get('created')-&gt;value;
  }

  /**
   * {@inheritdoc}
   */
  public function setCreatedTime($timestamp) {
    $this-&gt;set('created', $timestamp);
    return $this;
  }
I had my php code cached before adding the setCreatedTimemethod to my custom entity. After clearing the cache everything was fine! 

So in general: add the setCreatedTime method to your custom entity to make your created timestamp work.