Linker IT Software
Order Home
menubar-top-links menubar-top-rechts
SQL*XL: Database to Excel bridge encOffice: Protect your Excel file easy and safe
Home Products litLIB Help Date & Time functions

Buy now

Download now

LITlib - Excel Power Functions Pack
 
Add-in for Excel that adds additional cell functions to Excel.

litLIB Help - DateDiff function
litLIB Help
Product pages :
litLIB
Quick links:
help index
forums

Date and Time - DateDiff

Syntax:
=DateDiff(Interval, Date1, Date2, Optional FirstDayOfWeek, Optional FirstWeekOfYear)

Description:
Returns the number of intervals between two dates/times.

Interval : yyyy for year, q for quarter, m for month, d for day, ww for week, w for weekday, y for day of year, h for hour, n for minute, s for second.
Date1 : First date and time to consider
Date2 : Second date and time to compare with.
FirstDayofWeek : Optional. This constant specifies which day is considered to be the start of the week. 0 is the system default, 1 is Sunday, 2 is Monday, 3 is Tuesday, and so on.
FirstWeekOfYear : Optional. This constant specifies the first week of the year. If not specified the first week of the year is considered the week of January the 1st.  0 is the system default, 1 is week of January the 1st, 2 starts with the week that has at least 4 days, 3 starts the year with the first full week.

Example:

Compute the number of years between the two dates given.
=DateDiff("yyyy","01/01/2000","01/01/2003")
Compute the number of quarters between the two dates given.
=DateDiff("q","01/01/2000","01/07/2000")
Compute the number of months between the two dates given.
=DateDiff("m","01/01/2000","01/07/2000")

Compute the number of days between the two dates given.
=DateDiff("d","01/01/2000","10/01/2000")

Compute the number of weeks between the two dates given.
=DateDiff("ww","01/01/2000","01/02/2000")
Compute the number of hours between the two times given.
=DateDiff("h","12:05:30","15:30:10")
Compute the number of minutes between the two times given.
=DateDiff("n","12:05:30","12:09:35")
Compute the number of seconds between the two times given.
=DateDiff("s","12:05:30","12:05:35")

litLIB