Welcome  This site hosts database tutorials and a few volunteer sub-websites.  
Login
Skip Navigation Links
Home
Database Tutorials
Become a Member
My Account
Contact Us
Portfolio
KRL Emails - Private
Rovers - Private
Shufflers
RCHS Reunion
FUMC Choir Music
Garden Club - Private
Award

Formatting results to show just date, not time

Back to the tutorials list

bulletIntroduction

In many situations it may be preferable to show (as, for example, in a gridview) just a date such as "9/21/2007" as opposed to both date and time, such as "9/21/2007 12:15:03AM"

This tends to make the data much more readable, and most generally, only the date is needed.

bulletFixing the date format

With VWD, open your test website (it was named MyTutorialsWebsite), and then open the page called "DatabaseResultsPage.aspx". That page should display the database results you previously generated in a gridview, and the records include a DatePaid column that show both the date and time.

To change the date format to show date only:

1. Click on the expander arrow at the upper right of the Gridview, and select Edit Columns

2. In the lower left window, highlight the DatePaid field, which causes the bound field properties window to show up on the right

3.In the Data section, set the DataFormatString to: {0:MM/dd/yyyy}

4. In the Behavior section, set HTMLEncode to false, click OK, and Save

That's it. When you preview in Browser, the dates will show, but not the time.

Home   DatabaseTutorials   BecomeAMember   ContactUs    MyAccount   Portfolio   KRLEmails   Rovers   RCHS55Reunion
All graphics on this site are copyrighted