Drupal - Custom formatting of tokens for date fields

The Token module added direct support for datetime and daterange fields in December 2016. See https://www.drupal.org/project/token/issues/2786181.

You should be able to use something like [node:field_datetime:date:custom:Y]


In the Manage Display section of your content type can control the output of your date field token.

Under Custom Display Settings, make sure the Token checkbox is set so you can adjust your token display. Once set, you can navigate to the Token tab where you can set your date field's Format to Custom and add your custom PHP date() string in the Date/time format field.

enter image description here

Tags:

Datetime

Tokens

8