Time

Time

{{ time }}

Represents a specific instant in a specific timezone.

Name Type Description
is_valid Boolean Will always be true
is_future Boolean Will be true if the time is in the future and false if the time is in the past. Prevents the page from being fast-cached past when this would change from true to false
year Integer The calendar year
month Number The calendar month (1-12)
day Integer The calendar day of the month (1-31)
day_of_year Integer The day of the year (1-366)
day_of_week Integer The day of the week (Monday = 1, Sunday = 7)
hour Integer The hour of the day (0-23)
minute Integer The minute of the hour (0-59)
second Integer The second of the minute (0-59)
offset time_diff The utc offset of the timezone at this instant expressed as a time_diff (ranging from -14 to +14 hours)
timezone String The full timezone identifier
timezone_short String The shortened timezone identifier, if applicable, for the given timezone at this instant (may vary depending on time of year, and for some timezones may be the same as the full timezone identifier)
output String The instant output using the ISO 8601 standard (yyyy-MM-ddTHH:mm:ss.fffffff)

Examples

Time advanced

Copy
{% var meridian = 'am' %} {% var hours = article.post_date.date.hour %} {% if hours > 12 %} {% set hours = hours | minus: 12 %} {% set meridian = 'pm' %} {% endif %} The year was {{ article.post_date.date.year }}. It had been {{article.post_date.date.day_of_year}} days, or {{ article.post_date.date.month }} months and {{ article.post_date.date.day }} days past the new year. The day was a {{ article.post_date.date.day_of_week }} and the time was {{ hours }}:{{ article.post_date.date.minute }}{{ meridian }}, but that didn't matter.

Set Timezone with string manipulation

Copy
{% var cityname = "Amsterdam" %} {% set_timezone "Europe/" | append: cityname %}

Set Timezone by String

Copy
{% set_timezone "America/Indianapolis" %}