S98 Calculate the Time Between Two Dates
Use the S98 Tag to display the number of days, weeks, months or years between a given date and the current date.
Application
Donations2
Can You Add This S-Tag in the WYSIWYG content editor?
No, this S-Tag cannot be added using the WYSIWYG content editor toolbar. Add the S-Tag code to the HTML using the Plain Text editor.
Can You Add This S-Tag in the Luminate CMS WYSIWYG content editor?
No, this S-Tag cannot be added using the Luminate CMSWYSIWYG content editor. Add the S-Tag code to the HTML using the Plain Text editor in Luminate CMS.
Format
-
Standard
[[S98:parameters]]
-
XML
<convio:session name="98" param="parameters" />
Parameters
Tip: Use [[S98:help]]
to print a summary of valid parameters.
-
units - valid parameters are "days", "weeks", "months", and "years"
-
aspect - valid parameters are "until" and "after"
-
date - a date literal, which can be produced by an S-Tag
The most common valid values to format the date literal are:
e |
day of week |
number |
2 |
e |
day of week |
text |
Tuesday; Tue |
y |
year |
year |
1996 |
d |
day of year |
number |
189 |
m |
month of year |
month |
July; Jul; 07 |
d |
day of month |
number |
10 |
a |
halfday |
text |
PM |
k |
hour (0~11) |
number |
0 |
h |
clockhour (1~12) |
number |
12 |
h |
hour (0~23) |
number |
0 |
k |
clockhour (1~24) |
number |
24 |
m |
minute of hour |
number |
30 |
s |
second of minute |
number |
55 |
s |
fraction of second |
number |
978 |
z |
time zone |
text |
Pacific Standard Time; PST |
z |
time zone offset/ID |
zone |
-0800; -08:00; America/Los_Angeles |
Sample Code
- S Tags
To display shopping days remaining until Christmas 2025:
[[S98:days:until:2025-12-25:YYYY-MM-dd]]
To display days until a constituent’s membership expires:
[[E98:days:until:[[S1:membership_expiration_date]]:MM DD, YYYY]]
-
XML
<convio:session name="98" param="days:until:2025-12-25:YYYY-MM-dd" />