Difference between revisions of "Template:Countdown"

From Detective Conan Wiki
Line 1: Line 1:
<includeonly><div class="countdown-container">'''{{#expr: floor(({{#time:U|{{{1}}}}} - {{#time:U}}) / 86400)}}''' {{#ifeq: {{#expr: floor(({{#time:U|{{{1}}}}} - {{#time:U}}) / 86400)}} | 1 | day | days }}</div></includeonly>
+
<includeonly><div class="countdown-container">'''{{#expr: ceil(({{#time:U|{{{1}}}}} - {{#time:U}}) / 86400)}}''' {{#ifeq: {{#expr: ceil(({{#time:U|{{{1}}}}} - {{#time:U}}) / 86400)}} | 1 | day | days }}</div></includeonly>
 
<noinclude>Displays the offset of the date parameter inserted into the template from the current time (UTC), given in the number of days.
 
<noinclude>Displays the offset of the date parameter inserted into the template from the current time (UTC), given in the number of days.
 
<pre>{{Countdown|December 31, 2100}}</pre>
 
<pre>{{Countdown|December 31, 2100}}</pre>
Results in {{Countdown|December 31, 2100}}
+
Results in {{Countdown|December 24, 2024}}
<!--NOTE: It does not round the calculated value but removes the real part; if there are '''1.4''' days remaining, it returns '''1'''.-->
+
<!--NOTE: If there are '''1.4''' days remaining, it returns '''2''' days &c.-->
  
 
[[Category:Templates]]
 
[[Category:Templates]]
 
</noinclude>
 
</noinclude>

Revision as of 21:03, 25 December 2024

Displays the offset of the date parameter inserted into the template from the current time (UTC), given in the number of days.

{{Countdown|December 31, 2100}}

Results in -15 days