Click here to Skip to main content
15,886,578 members
Please Sign up or sign in to vote.
4.00/5 (1 vote)
how to get date part only from table where there was date and time ex:-2012-12-20 00:00:00.000
i want only 2012-12-20 instead of 2012-12-20 00:00:00.000
Posted

1 solution

this way...
SQL
select replace(convert(varchar(10),getdate(),102),'.','/')


function convert
convert( convert into type, datefield , Dateformat_to_apply )

Happy Coding!
:)
 
Share this answer
 
Comments
ntitish 5-Jan-13 6:41am    
select Login_Id,Job_Position,Elgibility,Location,Contact_Num,Last_Date_For_Apply,Job_Category,Experience_Details,Company_Name,Company_Profile,Company_Url,Status,Last_Modified_On from job_posting_details where Posting_Id=@Posting_Id

//this is the code for picking the data from the database table and displaying in this i want to show Last_Date_For_Apply only date can u modify it according to the code above ...
Aarti Meswania 5-Jan-13 6:44am    
select Login_Id,Job_Position,Elgibility,Location,Contact_Num,

replace(convert(varchar(10),Last_Date_For_Apply,102),'.','/') as Last_Date

,Job_Category,Experience_Details,Company_Name,Company_Profile,Company_Url,Status,Last_Modified_On
from job_posting_details
where Posting_Id=@Posting_Id
sariqkhan 5-Jan-13 7:15am    
can you help me sir http://www.codeproject.com/Questions/522079/Howplustoplusupdateplustheplusdatagridviewpluswhen
ntitish 5-Jan-13 7:29am    
thanks sir it is working...........
Aarti Meswania 5-Jan-13 7:32am    
Welcome! :)
Glad to help you! :)
do not call me sir, I am a girl and say 'aarti'.

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