Last modified by - 8 years ago
559 Views
1 min read

Formatting Date and Time

You can use WPAS tag functions for displaying date and time information in your view layouts. Some of these tag functions may accept additional parameter called a format string to determine how the date is going to be displayed.

Date Format: !#date-format[Attribute Date Tag,'Format']#


Formats the date attribute according to the format string.


For example, the format string:


!#date-format['l, F j, Y',!#person_birthdate#]#

creates a date that look like this:


Friday, September 24, 2004

Here is what each format character in the string above represents:



  • l = Full name for day of the week (lower-case L).

  • F = Full name for the month.

  • j = The day of the month.

  • Y = The year in 4 digits. (lower-case y gives the year's last 2 digits)


The following table shows the format characters you can use:






































































































Day of Month
d
Numeric, with leading zeros
01–31
j
Numeric, without leading zeros
1–31
S
The English suffix for the day of the month
st, nd or th in the 1st, 2nd or 15th.
Weekday
l
Full name  (lowercase 'L')
Sunday – Saturday
D
Three letter name
Mon – Sun
Month
m
Numeric, with leading zeros
01–12
n
Numeric, without leading zeros
1–12
F
Textual full
January – December
M
Textual three letters
Jan - Dec
Year
Y
Numeric, 4 digits
Eg., 1999, 2003
y
Numeric, 2 digits
Eg., 99, 03
Time
a
Lowercase
am, pm
A
Uppercase
AM, PM
g
Hour, 12-hour, without leading zeros
1–12
h
Hour, 12-hour, with leading zeros
01–12
G
Hour, 24-hour, without leading zeros
0-23
H
Hour, 24-hour, with leading zeros
00-23
i
Minutes, with leading zeros
00-59
s
Seconds, with leading zeros
00-59
T
Timezone abbreviation
Eg., EST, MDT ...
Full Date/Time
c
ISO 8601
2004-02-12T15:19:21+00:00
r
RFC 2822
Thu, 21 Dec 2000 16:01:07 +0200

Human Time Diff: !#human-diff[Attribute Date Tag From,Attribute Date Tag To]#


Determines the difference between two date attributes in a human readable format such as "1 hour", "5 mins", "2 days".


For example, the format string:


!#human-diff[!#issue_created_date#,!#issue_resolution_date#]#

creates a date that may look like this:


15 days ago

Human Time Diff to Now: !#human-diff[Attribute Date Tag]#


Determines the difference between a date attribute and current datetime in a human readable format such as "1 hour", "5 mins", "2 days".


For example, the format string:


!#human-diff[!#issue_created_date#]#

creates a date that may look like this:


15 days ago

Related Embeds
Previous Next
Related Panels
Related Articles
Related Documents
Previous Next
Was this information helpful?