• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 648
  • Last Modified:

Displaying Oracle DateTime field in .NET GridView

Experts,

I need your assistance in converting a Datetime field returned from an Oracle database into a .NET DateTime field which is displayed in a Grid View which shows only the Date part and not the Time
(For Eg: the Value in GridView is  6/11/1986 12:00:00 AM       and I want it as just c/11/1986)

I cannot create that column as a bound field as my DataSet returns variable columns everytime. So, there might or might not be a DateField in the DataSet too depending on the Query I run against the Database.

An early response would be really appreciated and helpful.

Thanx.
0
sydneyram
Asked:
sydneyram
1 Solution
 
Pra4444Commented:
Can you not retrieve the value from the Oracle as a character string using

select to_char(date,'MM\DD\YYYY') from your_query

0
 
CtrlAltDlCommented:
Try just selecting the Date like this:
SELECT TO_CHAR(YourDateFieldName, 'DD/MM/YY') FROM myTable
0
 
CtrlAltDlCommented:
Doh, I guess Pra4444 beat me to it.
0
The new generation of project management tools

With monday.com’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.

 
sydneyramAuthor Commented:
Awesome!!! thanks a lot for the quick response.
0
 
M3mph15Commented:
Hi,
You can set the DataFormatString to something like {0:dd/MM/yyyy}.

Hope this helps
-M3mph15
0
 
sydneyramAuthor Commented:
M3mph15,

In my case it is an autogenerated column and not databound so I cannot you the dataformatstring property.


Pra4444,
Is there any other way of doing the same on the .NET side? I have to make a lot of logical changes in my code if i incorporate the TO_CHAR method of doing it.

Thanks.
0

Featured Post

Never miss a deadline with monday.com

The revolutionary project management tool is here!   Plan visually with a single glance and make sure your projects get done.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now