ASP.net Access date field pulling time through as well

Posted on 2011-05-09
Medium Priority
Last Modified: 2012-05-11

In ASP.net I am using a GridView to view data from an Access table.
The date field, which is formatted as "sort date" in Access pulls through the
time as 12:00:00 AM as well. How do I stop this?
Question by:Murray Brown
  • 2
  • 2
LVL 31

Expert Comment

ID: 35718895
If you're using a BoundField, simply do as follows:
<asp:boundfield datafield="Your_Date_Column" dataformatstring="{0:dd/MMM/yyyy}" htmlencode="false" />

Open in new window

Just make sure you set the HtmlEncode attribute to False or it won't work.
LVL 31

Accepted Solution

MlandaT earned 1000 total points
ID: 35718900
LVL 13

Assisted Solution

Rick earned 1000 total points
ID: 35720446
You could use:


Or if you think your date field might contain null values, use this:


Author Comment

by:Murray Brown
ID: 35737124
Hi. The GridView is a default control and the SQL Select statement is a Select All. So I am not pulling specifics through

Author Closing Comment

by:Murray Brown
ID: 35737163
thanks for the help

Featured Post

[Webinar] Database Backup and Recovery

Does your company store data on premises, off site, in the cloud, or a combination of these? If you answered “yes”, you need a data backup recovery plan that fits each and every platform. Watch now as as Percona teaches us how to build agile data backup recovery plan.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Traditionally, the method to display pictures in Access forms and reports is to first download them from URLs to a folder, record the path in a table and then let the form or report pull the pictures from that folder. But why not let Windows retr…
If you need a simple but flexible process for maintaining an audit trail of who created, edited, or deleted data from a table, or multiple tables, and you can do all of your work from within a form, this simple Audit Log will work for you.
With Microsoft Access, learn how to start a database in different ways and produce different start-up actions allowing you to use a single database to perform multiple tasks. Specify a start-up form through options: Specify an Autoexec macro: Us…
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…
Suggested Courses

569 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question