Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
By uwe_k on
Hi,
how can I output a current / actual timestamp on site which is not cached?
I'm working with Drupal 8, if I put in a timestamp in twig it only refreshes after cache rebuild.
Thanks
Comments
Template? As in xyz.tpl.php?
Template? As in xyz.tpl.php?
Use:
<?php print(Date("Y")); ?>
Format date as desired.
# # #
Or am I misunderstanding your question?
Best,
Michael
Drupal Hosting
NIH Cancer Study: Supplemention with both vitamins and fenbendazole exhibited significant (P = 0.009) inhibition of tumor growth.
Thanks for your reply.
Thanks for your reply.
I'm on Drupal 8.0.6 and in the Twig template i get timestamp with
{{ date().getTimestamp }}
or
{{ 'now'|date('U') }}
and if cache is enabeled the timestamp is also cached and old timestamp is displayed on the site.
My question is, is there a way and what is the recommended way to pass a calculated value to users browser in Drupal 8?
Best,
Uwe