Difference between revisions of "Template:Interval"

From blackwiki
Jump to navigation Jump to search
imported>MSGJ
m (Protected Template:Interval: Highly visible template ([edit=sysop] (indefinite) [move=sysop] (indefinite)))
imported>MSGJ
(parameters 2-4 are optional and default to -1)
Line 9: Line 9:
 
  }}
 
  }}
 
  |2={{#ifeq:{{{format}}}|time
 
  |2={{#ifeq:{{{format}}}|time
   |{{#time:U|{{{2|0}}}}}
+
   |{{#time:U|{{{2|-1}}}}}
   |{{{2|0}}}
+
   |{{{2|-1}}}
 
  }}
 
  }}
 
  |3={{#ifeq:{{{format}}}|time
 
  |3={{#ifeq:{{{format}}}|time
   |{{#time:U|{{{3|0}}}}}
+
   |{{#time:U|{{{3|-1}}}}}
   |{{{3|0}}}
+
   |{{{3|-1}}}
 
  }}
 
  }}
 
  |4={{#ifeq:{{{format}}}|time
 
  |4={{#ifeq:{{{format}}}|time
   |{{#time:U|{{{4|0}}}}}
+
   |{{#time:U|{{{4|-1}}}}}
   |{{{4|0}}}
+
   |{{{4|-1}}}
 
  }}
 
  }}
 
  |rule={{#switch:{{{rule}}}
 
  |rule={{#switch:{{{rule}}}

Revision as of 15:30, 28 October 2010

Template:Interval/core

Template documentation[view] [edit] [history] [purge]

Usage

This template determines which interval a given value lies in.

The intervals are defined by the unnamed parameters. The value to be determined is named parameter n.

format=time can also be passed to the template. If set, the intervals and value will be compared as times (and if n is not provided, it will evaluate as the current timestamp).

Examples

Passing 2, 4 and 6 as the unnamed parameters defines the following intervals:

  • -∞<x<2
  • 2≤x<4
  • 4≤x<6
  • 6≤x<∞

Then:

Time

See also