Making datetime field return just time

Posted on 2009-02-15
Medium Priority
Last Modified: 2013-11-26

I've got a table stored as an .mdf in visual Studio

The field is set to datetime

I'm inputting values from a combo box (selecting time in 15 bunches)

But when it adds the time to the record the date is still displayed in the field

What do I need to change to make it just display the time in the records with no date

Question by:davecocks
  • 2
LVL 46

Accepted Solution

tbsgadi earned 2000 total points
ID: 23644720
Hi dave,

You need to format "hh:nn:ss"
See http://msdn.microsoft.com/en-us/library/8kb3ddd4.aspx

Good Luck!


Author Closing Comment

ID: 31547085
Hey Gary thanks for your input, especially as its a Sunday!

Your solution looked a little tricky, but you put me on the right track -
I've decided to just change the field at form end of things.

 So on the form with the record set -Edit columns - appearence - default cell style =
DataGridViewCellStyle { Format=t }
LVL 46

Expert Comment

ID: 23644811
Glad to help...even on a Sunday!

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
Simulator games are perfect for generating sample realistic data streams, especially for learning data analysis. It is even useful for demoing offerings such as Azure stream analytics, PowerBI etc.
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
Suggested Courses
Course of the Month13 days, 20 hours left to enroll

809 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