You are viewing the MafiaScum.net Wiki. To play the game, visit the forum.

Template:Timespan: Difference between revisions

From MafiaWiki
Jump to navigation Jump to search
(this wiki has got to have a security vulnerability somewhere, having not been updated in two/three years)
 
mNo edit summary
Line 1: Line 1:
{{#expr:(({{#time:U|{{{2|March 08, 2008 6:43:56 pm}}}}}-{{#time:U|{{{1|August 14, 2007 8:06:36 pm}}}}})/86400) mod 1461}} days, {{#expr:(({{#time:U|{{{2|March 08, 2008 6:43:56 pm}}}}}-{{#time:U|{{{1|August 14, 2007 8:06:36 pm}}}}})/3600) mod 24}} hours, {{#expr:(({{#time:U|{{{2|March 08, 2008 6:43:56 pm}}}}}-{{#time:U|{{{1|August 14, 2007 8:06:36 pm}}}}})/60) mod 60}} minutes{{#if:{{{3|?}}}|, {{#expr:({{#time:U|{{{2|March 08, 2008 6:43:56 pm}}}}}-{{#time:U|{{{1|August 14, 2007 8:06:36 pm}}}}}) mod 60}} seconds}}<noinclude>
{{#expr:(({{#time:U|{{{2|March 08, 2008 6:43:56 pm}}}}}-{{#time:U|{{{1|August 14, 2007 8:06:36 pm}}}}})/86400) mod 1461}} days, {{#expr:(({{#time:U|{{{2|March 08, 2008 6:43:56 pm}}}}}-{{#time:U|{{{1|August 14, 2007 8:06:36 pm}}}}})/3600) mod 24}} hours, {{#expr:(({{#time:U|{{{2|March 08, 2008 6:43:56 pm}}}}}-{{#time:U|{{{1|August 14, 2007 8:06:36 pm}}}}})/60) mod 60}} minutes{{#if:{{{3|}}}|, {{#expr:({{#time:U|{{{2|March 08, 2008 6:43:56 pm}}}}}-{{#time:U|{{{1|August 14, 2007 8:06:36 pm}}}}}) mod 60}} seconds}}<noinclude>
==Usage==
==Usage==
An extremely inefficient way of calculating the length between two datetimes. Used with <code><nowiki>{{timespan|start|end}}</nowiki></code>, such as <code><nowiki>{{timespan|August 14, 2007 8:06:36 pm|March 08, 2008 6:43:56 pm}}</nowiki></code>. Should be using the trunc or floor function, but somehow this wiki doesn't have that despite having the extension that does. As a result will fail for times greater than 4 years.
An extremely inefficient way of calculating the length between two datetimes. Used with <code><nowiki>{{timespan|start|end}}</nowiki></code>, such as <code><nowiki>{{timespan|August 14, 2007 8:06:36 pm|March 08, 2008 6:43:56 pm}}</nowiki></code>. Should be using the trunc or floor function, but somehow this wiki doesn't have that despite having the extension that does. As a result will fail for times greater than 4 years.

Revision as of 05:36, 12 February 2014

206 days, 22 hours, 37 minutes

Usage

An extremely inefficient way of calculating the length between two datetimes. Used with {{timespan|start|end}}, such as {{timespan|August 14, 2007 8:06:36 pm|March 08, 2008 6:43:56 pm}}. Should be using the trunc or floor function, but somehow this wiki doesn't have that despite having the extension that does. As a result will fail for times greater than 4 years.

To show seconds (default doesn't), use {{timespan|start|end|s}}.