Click here to Skip to main content
15,886,199 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi everybody, I'm try.
SQL
select dateadd(day, 30, '2014-09-01') as EXPDATE

but it display like this
SQL
2014-10-01 00:00:00.000

I just want like this
SQL
2014-10-01

Thank you for answer.
Posted

What is being returned is a date, the display of which depends on how you format it for viewing.

You can use FORMAT but it will give you a string as a result not a date type : http://www.w3schools.com/sql/sql_func_format.asp[^]
 
Share this answer
 
Comments
terzasek 2-Oct-14 14:42pm    
Thank you very much. ^ ^ :D
The string is being converted to a datetime type by default. Try explicitly converting it to a date first:
SQL
select dateadd(day, 30, CAST('2014-09-01' as date)) as EXPDATE
 
Share this answer
 
Comments
terzasek 2-Oct-14 14:42pm    
Wow! Very nice Thank you.

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