Click here to Skip to main content
15,890,506 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
I am getting Date column from sql server database.

SQL
Select ComplaintID, Subject, CONVERT(varchar(20),RecievedDate,103) as RecievingDate from Complaints
      where  Convert(date,RecievedDate)>= @DateFrom AND Convert(date,RecievedDate)<= @DateTo



it gives me date in this format, in asp.net.

16/05/2014

but i want like this

16/May/2014

how ?
Posted
Comments
Prasad Khandekar 16-May-14 7:07am    
Hello,

The value returned from the database is just the number representing the date & time. Have a look at this site to know more about formatting DateTime. (http://www.dotnetperls.com/datetime-format)

Regards,
Hunain Hafeez 16-May-14 7:11am    
i have to format it on database level must, please help

1 solution

try with

SQL
Select ComplaintID, Subject,REPLACE(convert(varchar, RecievedDate, 106), ' ','/') as RecievingDate from Complaints
      where  Convert(date,RecievedDate)>= @DateFrom AND Convert(date,RecievedDate)<= @DateTo
 
Share this answer
 
v3

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