Fullscreen
[Show/Hide Right Column]

Show the time until or after a date and time

Plugin Countdown

This Wiki Plugin displays a countdown to a future date. Or, if parameter start is set, also since a date in the past.

The enddate value provided by the user is converted from the user's local time to GMT/UTC date and time. Thus values will show hours until or since the current hour in GMT/UTC, not compared to local time.

The enddate value is NOT included in the count. If you want it included, you must specify the following date. In other words, if you have a deadline of March 31, 2015 for submissions and that day is still a valid submission day, the you must code enddate as the following day, i.e. April 1, 2015.

In Tiki9 this plugin has been fixed and improved:
  • select the correct time zone
  • add ability to show years and months;
  • cover entire time period regardless of time units shown;
  • ability to show calendar day difference (eg tomorrow is 1 day away even if less than 24 hours away);
  • allow custom text;
  • ability to set thousands separator;
  • time string punctuation and singular vs plural fixed



Usage and Parameters

To use this plugin in a wiki page, use the syntax:
Syntax for COUNTDOWN plugin
{COUNTDOWN(enddate=>April 1 2020)}countdown message{COUNTDOWN}


Parameter Accepted values Default Effect Required? Since
enddate Dates in multiple formats: Apr(il) 1 2020, 1 Apr(il) 2020, Apr-01-2020, 01-Apr-2020, 01-04-2020, 04/01/2020 none Displays number of days, hours, minutes and seconds until the enddate y
locatetime on or off on if set to off, shows date only (no time fields displayed) optional ?
show d=days, h=hours, m=minutes, s=seconds. Enter multiple values as: dh or dhm or dhms. dhms, unless locatetime=off specified, in which case no time components are shown specify which time components to be shown optional ?
since y or n y (v.6) n (v.4) whether to also provide countdown if enddate is in the past If set to y and value of enddate is in the past plugin returns days (and if asked, time) SINCE the date. If set to n and the value of enddate is in the past, the value returned will simply be the text string countdown message followed by the text string is over. ?
countdown message (text between the COUNTDOWN tags) string none Appends a text message to the end of the countdown n


Examples

1. This code,
{COUNTDOWN(enddate=>01-Apr-2020)} __the project is done!__ {COUNTDOWN}

arrow-right.png
Would produce:
2867 days, 22 hours, 28 minutes, 1 seconds, until the project is done!


2. This code,
{COUNTDOWN(enddate=>01-Apr-2010)} __the project start date__ {COUNTDOWN}

arrow-right.png
Would produce:
785 days, 1 hours, 31 minutes, 58 seconds, since the project start date.


3. This code,
{COUNTDOWN(enddate=>01-Apr-2010,show=dhm)} __the project start date__ {COUNTDOWN}

arrow-right.png
Would produce:
785 days, 1 hours, 31 minutes, since the project start date.


4. This code,
{COUNTDOWN(enddate=>01-Apr-2010,show=d)} __the project start date__ {COUNTDOWN}

arrow-right.png
Would produce:
785 days, since the project start date.


5. This code is a variant of the previous
{COUNTDOWN(enddate=>01-Apr-2010,locatetime=off)} __the project start date__ {COUNTDOWN}

arrow-right.png
and would thus produce the same result as the previous example
785 days, since the project start date.


6. while this code,
{COUNTDOWN(enddate=>01-Apr-2010,since=n)} __the project start date {COUNTDOWN}__

arrow-right.png
should produce:
the project start date is over
but doesn't, showing instead:
<-- i.e. nothing at all!

The software used by doc.tiki.org needs to be fixed. A correction is being submitted.


7. instead, this code,
{COUNTDOWN(enddate=>01-Apr-2010,since=y)} __the project start date__ {COUNTDOWN}__

arrow-right.png
produces:
785 days, 1 hours, 31 minutes, 58 seconds, since the project start date the project start date is over
In other words, it shows the formatted "text" (in this case in bold), then repeats it, followed by the text string " is over" (unformatted).





Contributors to this page: xavi67984 points  , Olaf-Michael Stefanov880 points  , lindon137 điểm  , olinuxx130 points  , piedramania35 points  , sylvie7387 points  and Tom Jarvis71 points  .
Page last modified on Friday 23 March, 2012 14:03:21 UTC by xavi67984 points .
The content on this page is licensed under the terms of the Creative Commons Attribution-ShareAlike License.

Site Language

Reference Guide

Keywords

These keywords serve as "hubs" for navigation within the Tiki documentation. They correspond to development keywords (bug reports and feature requests):



Tiki Newsletter

Delivered fresh to your email inbox!
Newsletter subscribe icon
Don't miss major announcements and other news!
Contribute to Tiki