C# .NET - removing time part from datetime values
Asked By Aryan Bhatt on 29-Dec-05 06:38 PM
I am fetching the datetime values from a database column and displaying them on a form. The database is Oracle 8i. However while displaying I only wish to display the date part i.e. I want to remove the time part from the value fetched..
Please tell me how this can be achieved in C#.
Thanks in advance,
Asked By F Cali on 29-Dec-05 07:59 PM
Instead of doing if from the client-side/application-side, you should do it in the database side. To remove the time part in a datetime value in Oracle, you use the TRUNC function. This will remove the time part.
You can use
Asked By Aarthi Saravanakumar on 29-Dec-05 08:37 PM
DateTime d ="10/25/2005 8:00:00';
try this another option
Asked By Gopinath G on 02-Jan-06 06:31 AM
alternatively you can use like this...
if you are fetching as DateTime value (datValue)...
string strDate = datValue.ToString("dd/MM/yyyy");
Asked By Robbe Morris on 02-Jan-06 08:49 PM
Oracle uses this function and its arguements to format dates into desired formatted date strings.
parse string to date in short date format
Asked By Laith Momani on 03-Jan-06 04:42 AM
my database returns a shortdate format and thats fine, but my user is supposed to select a date from the dates dropdown list and then the date goes again in a query to return results. when i parse the string returned by the drodownlist or the dtaeTime object returned it returns it in (dd/ss/yy hh:mm:ss) format.
My question is: How do i parse a string to dateTime object with shortDate (mm/dd/yyyy) format. ???