Home » SQL ServerRSS

How to remove time field in oracle datetime ?

hi guys,

 

i am using oracle 10g as database, i have a textbox called Transaction date,

i want to save transaction date into column filed called TDate (Date),

actually i am using ajax calender extender to get date in the format of 23-sep-2010,

when i retrieve the record it shows me like 23-sep-2010 12:00:00 AM

i want to remove the time filed..i used query " select TDate from Tranaction where TID=1"

txt_Tdate.Text=ds.Tables[0].Rows[0]["TDate"].ToString();

but it shows like this 23-sep-2010 12:00:00 AM,how to remove the time field

 

 

 

3 Answers Found

 

Answer 1

You could do that in C#, Lets assume you have the string value of a date  as below:

      string strDate = "23-sep-2010 12:00:00 AM";
      DateTime tempDate = Convert.ToDateTime(strDate);
      string strShortDate = tempDate.ToShortDateString();

you can use methond ToShortDateString on DateType object. 

 

 

Answer 2

Yes, its simple as Habib OSU mentioned,

txt_Tdate.Text=ds.Tables[0].Rows[0]["TDate"].ToShortDateString();

This would display just the date on your text box.

For more information on ToShortDateString() method:

http://msdn.microsoft.com/en-us/library/system.datetime.toshorttimestring.aspx

 

Regards,

Samreen

 

Answer 3

Hi Saravanan2009,

Welcome to MSDN forums!

If your question has been solved, please don’t forget mark/vote the replies which helped you, and this will encourage the other community members to join in discussion and help each one.


Hope these helps, if you have any problems, please feel free to let me know.

Best Regards,
Alan Chen
________________________________________
Please remember to mark the replies as answers if they help and unmark them if they provide no help

 
 
 

<< Previous      Next >>


Microsoft   |   Windows   |   Visual Studio   |   Follow us on Twitter