SQL Server simple time format function?

Posted on 2005-05-13
Last Modified: 2010-03-19
Is their a built in function in SQL SErver which would allow me to make sure the
time my user enters is in the format 4:00pm

Really all I need is the ability to SELECT this format
Question by:dylanone
    LVL 21

    Expert Comment

    Seems like the sort of thing you should handle in the application....your users aren't entering data directly through Enterprise Manager are they?
    LVL 75

    Accepted Solution

    >>Is their a built in function in SQL SErver which would allow me to make sure the
    time my user enters is in the format 4:00pm <<
    If you are asking about validating input, than this is the responsibility of the presentation layer not the database.  If all you want to see is the time using a date time column than you can use:

    Select RIGHT(CONVERT(varchar(30), getdate(), 100), 7)

    Author Comment

    In this case my users enter data into the content management tool - then at that point I run selects and verify the data on the record currently being enetered - if a problem occurs - the system has built in error messages

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    How your wiki can always stay up-to-date

    Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
    - Increase transparency
    - Onboard new hires faster
    - Access from mobile/offline

    This is my first ever Article on EE or elsewhere; therefore, please bear with me if I have some discrepancies in my writing. I read many articles and questions related to "how to pass values to SSIS packages at run-time?"  Hence, this common ques…
    Let's review the features of new SQL Server 2012 (Denali CTP3). It listed as below: PERCENT_RANK(): PERCENT_RANK() function will returns the percentage value of rank of the values among its group. PERCENT_RANK() function value always in be…
    Via a live example, show how to shrink a transaction log file down to a reasonable size.
    Viewers will learn how to use the UPDATE and DELETE statements to change or remove existing data from their tables. Make a table: Update a specific column given a specific row using the UPDATE statement: Remove a set of values using the DELETE s…

    759 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

    11 Experts available now in Live!

    Get 1:1 Help Now