Stacks API

Come build with us.
Stacks API v13 for Stacks 5.0


  <   Templates Variable Reference


This content is open source. You can edit it and submit a pull request on GitHub.
This page is generated from this file.


© . YourHead Software all rights reserved.

Date Values

%id=dateID%

Available: Stacks API v10

Usage

%id=<dateControlID>%
%id=<dateControlID> -format="<format>" %
%id=<dateControlID> -dateStyle="<short, medium, long, or full>" %
%id=<dateControlID> -timeStyle="<short, medium, long, or full>" %

Description

Output a long format full date/time string that is compatible with Moment.js (the default), a localized date or time style, or a specified date format.

Note: date controls have been available since API v5, however the format and style parameters were introduced in API v10

Example 1: Long format date

template:

    The UNIX date is: %id=dateProperty%

The UNIX date is: 2017-06-27T18:48:09CDT

Example 2: Short localized time

template:

    The time is: %id=dateProperty -timeStyle="short"%

The time is: 7:25 PM

This is in the US. In other locales it will appear formatted for that region.

Example 3: Full localized date

template:

    The date is: %id=dateProperty -dateStyle="full"%

The date is: Tuesday, June 27, 2017

This is in the US. In other locales it will appear formatted for that region.

Example 4: Long time and short date

template:

    It is %id=dateProperty -timeStyle="long"% on %id=dateProperty -dateStyle="short"%

It is 6:48:09 PM CDT on 6/27/17

Example 5: Custom format

template:

    This is the year %id=dateProperty -format="yyyy"%.

This is the year 2017.

© . YourHead Software all rights reserved.