Click here to Skip to main content
Rate this: bad
good
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
ntitish1.4K

1 solution

Rate this: bad
good
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 | :)
  Permalink  
Comments
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
 
,Job_Category,Experience_Details,Company_Name,Company_Profile,Company_Url,Status,Last_Modified_On
from job_posting_details
where Posting_Id=@Posting_Id
sariqkhan at 5-Jan-13 7:15am
   
can you help me sir http://www.codeproject.com/Questions/522079/Howplustoplusupdateplustheplusdatagridviewpluswhen
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 asp.net 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 Sergey Alexandrovich Kryukov 355
1 _Amy 235
2 Peter Leow 185
3 Andreas Gieriet 180
4 Dave Kreskowiak 155
0 OriginalGriff 7,540
1 Sergey Alexandrovich Kryukov 6,462
2 Maciej Los 3,849
3 Peter Leow 3,653
4 CHill60 2,712


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