Making datetime field return just time

Posted on 2009-02-15
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
    LVL 46

    Accepted Solution

    Hi dave,

    You need to format "hh:nn:ss"

    Good Luck!

    LVL 1

    Author Closing Comment

    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

    Glad to help...even on a Sunday!

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Better Security Awareness With Threat Intelligence

    See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

    Introduction While answering a recent question about filtering a custom class collection, I realized that this could be accomplished with very little code by using the ScriptControl (SC) library.  This article will introduce you to the SC library a…
    Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
    As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
    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…

    779 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

    Need Help in Real-Time?

    Connect with top rated Experts

    15 Experts available now in Live!

    Get 1:1 Help Now