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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Convert datetime to integer

Status
Not open for further replies.

jtarry

IS-IT--Management
Mar 10, 2010
22
GB
I wish to update a table with an integer showing the difference between two dates.

update table
set fieldint = date1 - date2

Thanks
 
Check DateDiff() function in BOL.
BTW Date2 - Date1 is also valid expression. That will give you difference between two datetime fields in days.

Borislav Borissov
VFP9 SP2, SQL Server 2000,2005 & 2008.
 
Did I said date?
I said datetime, isn't it?

But BTW I was wrong.

Date2 - Date1 = datetime :)

Borislav Borissov
VFP9 SP2, SQL Server 2000,2005 & 2008.
 
Have have resolved my problem with DateDiff() function by inserting into a varable

Thanks
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top