ComboStrap - Date Component

About

With the date component, you can format any date:

Example

Today's date

  • The markup
<date/>
  • The output is a date formatted to the default format.

Saturday, 23 October 2021

To have it refresh every day, we expire the cache date daily

<cache expiration="@daily"/>

Today's date - short format

  • Today's date with a short month description and the day number US style
<date format="%h %d"/>
  • The output:

Oct 23

Today's date in French

  • The markup with the lang attribute
<date lang="fr"/>
  • The output is a date formatted with French word.

samedi, 23 octobre 2021

Date specified manually

<date format="%A">2021-09-27</date>
  • The output gives the day name of the date (ie %A)

Monday

Date of a page

With a template component, you can even print a date metadata of a page.

<template>
    <date>$date_published</date>
</template>
  • The output will be:

Sunday, 26 September 2021

Syntax

  • For the today's date
<date format="formatValue" lang="langValue"/>
  • When specifying a date value
<date format="formatValue" lang="langValue">dateValue</date>

where:

Powered by ComboStrap