Wrox Programmer Forums
|
BOOK: Beginning ASP.NET 4 : in C# and VB
This is the forum to discuss the Wrox book Beginning ASP.NET 4: in C# and VB by Imar Spaanjaars; ISBN: 9780470502211
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Beginning ASP.NET 4 : in C# and VB section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old August 8th, 2012, 06:06 AM
Authorized User
 
Join Date: Jun 2010
Posts: 39
Thanks: 0
Thanked 0 Times in 0 Posts
Default How to Substract with Sysdate ?

I have a table in SQL Server in which there is a column LastLoginDate
Datatype Datetime . I would like to substract LastLoginDate with sysdate.

Last Loin Date SysDate
(7/20/2012 7:01:48 AM)-(8/07/2012 7:01:48 AM)

I would like to claculate only number of days.
Please help me.
 
Old August 8th, 2012, 06:24 AM
Authorized User
 
Join Date: Mar 2012
Posts: 59
Thanks: 2
Thanked 4 Times in 4 Posts
Default

You can use the datediff function to accommodate this. i.e:-

Dim NoDaysDifference As Integer = DateDiff(DateInterval.Day, LastLoginDate, Now())

Hope this helps.

Cheers

Ian
 
Old August 10th, 2012, 01:49 AM
messyleon
Guest
 
Posts: n/a
Default

Functions that expect date values usually accept datetime values and ignore the time part. Functions that expect time values usually accept datetime values and ignore the date part.The CURRENT_TIMESTAMP(), CURRENT_TIME(), CURRENT_DATE(), and FROM_UNIXTIME() functions return values in the connection's current time zone, which is available as the value of the time_zone system variable.
http://www.dapfor.com/en/net-suite/n...ial/data-types





Similar Threads
Thread Thread Starter Forum Replies Last Post
How to substract with Sysdate ? Abhishek Kumar BOOK: Beginning C# 2005 Databases 0 August 7th, 2012 12:41 PM
How to substract with Sysdate? Abhishek Kumar SQL Language 0 August 7th, 2012 12:39 PM
How to subtract hours from sysdate in oracle mcmouli Oracle 4 January 7th, 2011 06:52 AM
substract the date . . . . . . . . . pandjie JSP Basics 1 January 29th, 2005 10:25 PM
sysdate mateenmohd SQL Server 2000 3 September 28th, 2003 07:42 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.