Click here to Skip to main content
11,638,881 members (68,747 online)
Rate this: bad
Please Sign up or sign in to vote.
See more: SQL-server-2005
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 4-Jan-13 23:59pm

1 solution

Rate this: bad
Please Sign up or sign in to vote.

Solution 1

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

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

Happy Coding!
Smile | :)
ntitish at 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 at 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

from job_posting_details
where Posting_Id=@Posting_Id
sariqkhan at 5-Jan-13 7:15am
can you help me sir
ntitish at 5-Jan-13 7:29am
thanks sir it is working...........
Aarti Meswania at 5-Jan-13 7:32am
Welcome! :)
Glad to help you! :)
do not call me sir, I am a girl and say 'aarti'.
ntitish at 7-Jan-13 0:10am
sorry aarti....
Aarti Meswania at 7-Jan-13 0:12am
it's ok :)
have a nice day! :)
ntitish at 7-Jan-13 0:25am
aarti i had one more question to ask.that was i want to know whether there will be a click event of menu control. because in my website i used menu control for displaying menus and i am displaying four alert panels below the menu control. here i want to display only three panels according to the click event of menu item will it possible.
Aarti Meswania at 7-Jan-13 0:30am
I have basic knowledge in I am working in winforms from more than 2 years, as per i know,...
it could be like simple button click event

<asp:Button ID="Button1" runat="server" Style="left: 437px; position: absolute; top: 258px"

Text="Button" Width="69px" OnClick="Button1_Click" />

parallel menu item code:

<asp:Menu ID="Menu1" runat="server" onmenuitemclick="OnMenuItemClick" >

with this:

protected void Page_Load(object sender, EventArgs e)
Button1.Attributes.Add("OnClick", "return getFile();");
Menu1.Attributes.Add("onmenuitemclick", "return getFile();");

protected void Button1_Click(object sender, EventArgs e)

protected void OnMenuItemClick(object sender, MenuEventArgs e)
panel1.visible = false;
sariqkhan at 5-Jan-13 7:16am
+5 for the convert function

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

  Print Answers RSS
0 OriginalGriff 9,061
1 Sergey Alexandrovich Kryukov 8,773
2 Mika Wendelius 7,027
3 Suvendu Shekhar Giri 2,494
4 F-ES Sitecore 2,438

Advertise | Privacy | Mobile
Web02 | 2.8.150728.1 | Last Updated 6 Jan 2013
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100