<p>Craft does not keep track of the <code>dateUpdated</code> timestamp (or revision history in general) per site. You don't mention the actual use case, but regardless – you're not going to be able to use the native <code>dateUpdated</code> attribute for what you're trying to achieve.</p>
<p><em>Your only option is to keep track of the per-site update timestamp yourself, via some sort of custom field.</em> I can think of at least 3 ways to do that:</p>
<ol>
<li><p>By far the simplest solution is to <strong>create a custom Date field</strong>. <em>Make the field translatable per site</em>, and instruct authors to manually update this field whenever they publish changes to entries.</p>
</li>
<li><p><strong>You can install the <a href="https://plugins.craftcms.com/preparse-field" rel="nofollow noreferrer">Preparse plugin</a></strong>, and create a custom <em>Preparse</em> date field. Preparse fields can be configured with simple, inline Twig templates that are rendered whenever the element is saved; the rendered value being automatically stored as a regular custom field value.</p>
</li>
</ol>
<p><em>Set the field's &quot;Column Type&quot; setting to &quot;Date (datetime)&quot;, and again - make it translatable per site.</em> Then, add something like this to the field's &quot;Twig code to parse&quot; setting:</p>
<pre><code>{{ now|date('Y-m-d H:i:s') }}
</code></pre>
<p>⚠️ <em>Note that the Preparse plugin is not available for Craft 5 yet.</em></p>
<ol start="3">
<li><strong>Create a custom <a href="https://craftcms.com/docs/5.x/extend/module-guide.html" rel="nofollow noreferrer">Yii module</a></strong> that saves the current date/time, per site... <em>somewhere</em>, whenever the relevant entries are saved. Custom modules are a huge topic, but some pointers:</li>
</ol>
<ul>
<li><p>Your module would need to add an <a href="https://craftcms.com/docs/5.x/extend/events.html" rel="nofollow noreferrer">event listener</a> listening for the proper element event (<a href="https://craftcms.com/docs/5.x/extend/events.html#saving-entries" rel="nofollow noreferrer">likely <code>Entry::EVENT_BEFORE_SAVE</code></a>), to &quot;capture&quot; the entries as they are being saved.</p>
</li>
<li><p>In your event listener, you need to save the current date/time somewhere. The easiest option would probably be to create a Date field (again, make the field translatable by site), and set it like so:</p>
</li>
</ul>
<pre class="lang-php prettyprint-override"><code>...
$entry-&gt;setFieldValue('dateUpdatedCustomField', (new \DateTime())-&gt;format('Y-m-d H:i:s');
...
</code></pre>

CC BY-SA 4.0
2024-04-04T22:26:55.737Z
2024-04-04T22:26:55.737Z
Mats Mikkel Rummelhoff
<p>I need to be able to distinguish when entries for multilingual websites were last updated. If I use entry -&gt; dateUpdated, it gives me the same date for the English and German version of the entry, even if I have only changed it in one language. Does anyone know if I can distinguish this and if so, how?</p>

<entries><updates>
dateUpdated for different sites
# dateUpdated for different sites

(Asked by: username_0 on 2024-04-04)

I need to be able to distinguish when entries for multilingual websites were last updated. If I use entry -> dateUpdated, it gives me the same date for the English and German version of the entry, even if I have only changed it in one language. Does anyone know if I can distinguish this and if so, how?

**Tags:** entries, updates

---

## 1 answers

### Answer by username_1 on 2024-04-04. Score: 3

Craft does not keep track of the dateUpdated timestamp (or revision history in general) per site. You don't mention the actual use case, but regardless – you're not going to be able to use the native dateUpdated attribute for what you're trying to achieve.
Your only option is to keep track of the per-site update timestamp yourself, via some sort of custom field. I can think of at least 3 ways to do that:

By far the simplest solution is to create a custom Date field. Make the field translatable per site, and instruct authors to manually update this field whenever they publish changes to entries.

You can install the Preparse plugin, and create a custom Preparse date field. Preparse fields can be configured with simple, inline Twig templates that are rendered whenever the element is saved; the rendered value being automatically stored as a regular custom field value.


Set the field's "Column Type" setting to "Date (datetime)", and again - make it translatable per site. Then, add something like this to the field's "Twig code to parse" setting:
{{ now|date('Y-m-d H:i:s') }}

⚠️ Note that the Preparse plugin is not available for Craft 5 yet.

Create a custom Yii module that saves the current date/time, per site... somewhere, whenever the relevant entries are saved. Custom modules are a huge topic, but some pointers:


Your module would need to add an event listener listening for the proper element event (likely Entry::EVENT_BEFORE_SAVE), to "capture" the entries as they are being saved.

In your event listener, you need to save the current date/time somewhere. The easiest option would probably be to create a Date field (again, make the field translatable by site), and set it like so:


...
$entry->setFieldValue('dateUpdatedCustomField', (new \DateTime())->format('Y-m-d H:i:s');
...


---

