Display Pattern: Date Time

Summary

Ā 

Show a ā€œPublish Meā€ message when a date (Id: embargoDate) on a Layer (Id: corporateInformation) is today or before today.

{% assign today_date = 'now' | date: '%s' %} {% assign embargo_date = data.corporateInformation.embargoDate | local_date %} {% if today_date => embargo_date %} Embargo lifted! Publish Me! {% endif %}

Setup in Picturepark

  • Layer "Corporate Information"

  • The date time field "Embargo date"

Field Value Access

To use the date-time value in the display pattern, you must convert it by passing the liquid filter local_date. Local date uses the timezone of the regional settings of my client laptop or like.

data.corporateInformation.embargoDate | local_date

Date Format Syntax

You can format the date to different formats, the syntax is like strf.

  • %m > month as 01..12

  • %b > month as Janā€¦Dec

  • %Y > year with century as 2021

  • %y > year without century as 21

{{data.xmpMetadata.xmp.createDateĀ |Ā date:Ā "%Y-%m"}} Output: 2021-06
{{data.xmpMetadata.xmp.createDateĀ |Ā date:Ā "%Y"}} Output: 2021

Use Case

A valid use case is to check if the embargo date is passed and the content can be published:











FotoWare Switzerland AG - CH-5033 Buchs - Switzerland
https://picturepark.com - support@picturepark.com
Ā© 2023 FotoWare Switzerland AG