i have a date field with type varchar. now i want to get time difference in days with today's date how can i get it?
actually i want to get rows which have day difference of more than 30 days.I have a field of lastlogin,i want to compare lastlogin with today's datetime and if the difference is more than 30 days we want to send those persons emails.
Loading
Neha SharmaPosted Jan 3, 2013, 2:25 AM
may be it ll help you and l give you some ideas to get the desired result:
http://stackoverflow.com/questions/2821040/how-do-i-find-the-time-difference-between-two-datetime-objects-in-asp-net
if not then please let me know.
Thanks.
sathish kumarPosted Jan 3, 2013, 1:23 AM
DateTime EndDate= convert.Todatetime(txtbox2.text).tostring();
TimeSpan ts;
ts= startDate- EndDate
int s = ts.Todays();
Hope this will help u out......
Shankar MPosted Nov 27, 2012, 4:00 AM
Yes, You can use the cast to convert it to DATE type.
Hope the below link might help you.
http://sqlusa.com/bestpractices2005/sqlserverstringtodate/
Thanks,
Shankar
Muhammad younasPosted Nov 27, 2012, 3:51 AM
Shankar MPosted Nov 27, 2012, 3:31 AM
Hi User,
Convert the varchar datatype to date and try comparing using the DATEDIFF function.
Something like this,
select datediff(d,getdate(),getdate()); will get you the Difference in days.
Thanks,
Shankar