?
Solved

ASP.net Access date field pulling time through as well

Posted on 2011-05-09
5
Medium Priority
?
307 Views
Last Modified: 2012-05-11
Hi

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?
0
Comment
Question by:Murray Brown
  • 2
  • 2
5 Comments
 
LVL 31

Expert Comment

by:MlandaT
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.
0
 
LVL 31

Accepted Solution

by:
MlandaT earned 1000 total points
ID: 35718900
0
 
LVL 13

Assisted Solution

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

   DateValue(DateField)

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

   IIF(IsDate(DateField),DateValue(DateField),Null)
0
 

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
0
 

Author Closing Comment

by:Murray Brown
ID: 35737163
thanks for the help
0

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