Click here to Skip to main content
15,917,455 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hello friends,

if i select date in html calender as 12-feb-2011 and i need to display date as 12-jan-2011 by using sql query
Posted
Updated 22-Feb-11 1:01am
v2
Comments
Prerak Patel 22-Feb-11 7:05am    
You select date in html calender then where database comes in picture?!

You should use DateAdd and add -1 as you want to decrement.

If C#, use this[^]
If SQL, use this[^]
 
Share this answer
 
v2
Replace getdate() with your date.
SQL
SELECT REPLACE(CONVERT(VARCHAR(11), DATEADD(month,-1,GETDATE()), 106), ' ', '-') AS [DD-Mon-YYYY]
 
Share this answer
 
Comments
beginner in C#.net 22-Feb-11 7:33am    
tnx friend

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