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
mNo edit summary
m (there's got to be a better way, but at least this helps)
 
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:trunc (({{#time:U|{{{2|March 08, 2008 6:43:56 pm}}}}}-{{#time:U|{{{1|August 14, 2007 8:06:36 pm}}}}})/86400)}} 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>.


To show seconds (default doesn't), use <code><nowiki>{{timespan|start|end|s}}</nowiki></code>.
To show seconds (default doesn't), use <code><nowiki>{{timespan|start|end|s}}</nowiki></code>.


[[Category:Templates]]</noinclude>
[[Category:Templates]]</noinclude>

Latest revision as of 18:48, 22 June 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}}.

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