Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Compare Dates 1

Status
Not open for further replies.

MadBnz

Technical User
Jan 30, 2002
18
NZ
Hi,

I have a SQL database that contains various date fields and a record number.

I want to compare two dates from a record and get the time difference i.e. when the Item was supposed to arrive and when it did actually arrived. Im looking for an output which looks like

"Item", "Deadline Time", "Arrival Time", "Time Difference"

Repeated for the various items
Thanks in advance.
 
Hiya,

The function that you need is DATEDIFF. Depending on how you want to see the information, the syntax is

DATEDIFF (part_of_date [eg. dd, hh etc.], due_date, actual_date).

This will give a positive figure for late deliveries, and a negative figure for early deliveries.

HTH

Tim
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top