Click here to Skip to main content
16,004,602 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hi All,

I am using VS2008,C#.net,Sqlserver 2005 and Window form application.

I want to know how can find total month and remaining days between 2 dates.
I am using this type of sql query.

date in mm/dd/yyyy format

SQL
Select Datediff(day, CONVERT(VARCHAR(10),'02/24/2012',101),CONVERT(VARCHAR(10),'03/29/2012',101)) as RetDate

out find from this query -- 34

but we need this type of out--- 1 month, 5 day

help will be appreciated
any idea or suggestion
thanks
mukesh
Posted
Updated 5-Apr-12 2:24am
v2

You need to use a little math, like what you learned in primary school.
 
Share this answer
 
Comments
mukesh_panth 5-Apr-12 8:58am    
i am not getting understand by code plz tell me solution
[no name] 5-Apr-12 9:05am    
2 + 2 = 4
This Codeproject article will help you.

Calculating Duration Between Two Dates in Years, Months and Days[^]
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900