Jump to content
 







Main menu
   


Navigation  



Main page
Contents
Current events
Random article
About Wikipedia
Contact us
Donate
 




Contribute  



Help
Learn to edit
Community portal
Recent changes
Upload file
 








Search  

































Create account

Log in
 









Create account
 Log in
 




Pages for logged out editors learn more  



Contributions
Talk
 



















Contents

   



(Top)
 


1 Description  





2 Usage  





3 Examples  





4 See also  














Template:DATEDIFF2






العربية
Bosanski
فارسی
ि
Bahasa Indonesia

Română
Simple English
ி
 

Edit links
 









Template
Talk
 

















Read
Edit
View history
 








Tools
   


Actions  



Read
Edit
View history
 




General  



What links here
Related changes
Upload file
Special pages
Permanent link
Page information
Get shortened URL
Download QR code
Wikidata item
 




Print/export  



Download as PDF
Printable version
 
















Appearance
   

 






From Wikipedia, the free encyclopedia
 


For dates from 1 January 1970 onward only!

This template returns the difference in days (possibly with decimals) between two dates in the Gregorian calendar. The return value is positive if date2 comes after date1, and is negative if date2 comes before date1 (i.e. the template computes date2 - date1). This template is identical to {{DATEDIFF}}, except that it requires only that up to two parameters be inputted instead of up to twelve since it makes use of the #time: parser function.

Usage

[edit]

If two dates supplied, the template calculates the difference between them, in days. If only one date is supplied, then the supplied date is calculated against the current date. If no dates are supplied, the template calculates the number of days from the start of the Julian epoch to the current date. If an invalid date is supplied, then the text is returned unaltered.

The inputted dates may be in any format understood by the #time: parser function. E.g., July 18, 2008, 18 July 2008 and 2008-07-18 are all valid. Hours, minutes and seconds can likewise be inputted.

This template can be used for dates from 1 January 1970 onward only.

Examples

[edit]
Code Output
{{DATEDIFF2|18 July 2008|2008-07-16}} -2
{{DATEDIFF2|July 16, 2008 8PM|2008-07-18 8:00:00}} 1.5
{{DATEDIFF2|2008-07-18}} 5822.4948610999
{{DATEDIFF2|{{#time:c}}}} should always equal zero
{{DATEDIFF2}} 739460.4948611
{{DATEDIFF2|invalid}} invalid

See also

[edit]

Retrieved from "https://en.wikipedia.org/w/index.php?title=Template:DATEDIFF2&oldid=457733019"

Category: 
Date-computing templates
 



This page was last edited on 27 October 2011, at 22:44 (UTC).

Text is available under the Creative Commons Attribution-ShareAlike License 4.0; additional terms may apply. By using this site, you agree to the Terms of Use and Privacy Policy. Wikipedia® is a registered trademark of the Wikimedia Foundation, Inc., a non-profit organization.



Privacy policy

About Wikipedia

Disclaimers

Contact Wikipedia

Code of Conduct

Developers

Statistics

Cookie statement

Mobile view



Wikimedia Foundation
Powered by MediaWiki