The format string is the most advanced part of the timers here at Countdown City, but yet really easy to use.
Have a look at this standard format string:
Time left: $d (d|day|days), $h (h|hour|hours), $m (m|minute|minutes) and $s (s|second|seconds)
Let's break it apart.
We have two kinds of special patterns to look for:
-
$d, $h, $m and $s.
These are substituted by the number of days, hours, minutes and seconds left to the event.
-
(d|day|days), (h|hour|hours), (m|minute|minutes) and (s|second|seconds)
Looking at (d|day|days), the d next to the opening parenthesis means that we are looking at the number of days. Then comes a divider (|).
If the number of days equals one, the part behind the first divider (day) is displayed.
Otherwise, the part behind the second divider (days) is displayed.
The closing parenthesis ends our special pattern.
This works with hours, minutes and seconds as well. All you do is to substitute d with h, m or s
All other text is displayed as it is.