Click here to Skip to main content
12,956,433 members (73,568 online)
Rate this:
Please Sign up or sign in to 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 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!
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

from job_posting_details
where Posting_Id=@Posting_Id
sariqkhan 5-Jan-13 7:15am
can you help me sir
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'.
ntitish 7-Jan-13 0:10am
sorry aarti....
Aarti Meswania 7-Jan-13 0:12am
it's ok :)
have a nice day! :)
ntitish 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 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 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
Top Experts
Last 24hrsThis month
OriginalGriff 6,869
CHill60 3,550
Maciej Los 3,302
ppolymorphe 2,080
Jochen Arndt 1,973

Advertise | Privacy | Mobile
Web01 | 2.8.170525.1 | Last Updated 6 Jan 2013
Copyright © CodeProject, 1999-2017
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