Problems formatting output from SQL DateTime Field

Posted on 2009-02-17
Last Modified: 2012-06-21
My data starts in this format: 2009-02-16 22:00:02

Gets put into a SQL DateTime field, which looks like this: 2/16/2009 10:00:02 PM

I'm using the Grid component from Obout, and when I try to format the output for the datetime field, I'm using this format: {0:MMMM dd, yyyy hh:mm AM}

Sadly, it always ends up saying "A2" at the end, regardless of AM/PM.  I changed the format to: {0:MMMM dd, yyyy hh:mm} and it just displays "February 16, 2009 10:00".  It should obviously say 22:00.

I know throwing the Obout component in here adds some difficulties, but I'm hoping someone is familiar enough with it to help me out...
Question by:Cerixus
    LVL 11

    Expert Comment


    {0:MMMM dd, yyyy hh:mm tt}
    LVL 11

    Accepted Solution

    tt is the abbreviattion for using AM/PM in a format.  If you want 24 hour time use capital HH for hours instead of lower-case.
    LVL 1

    Author Closing Comment

    Excellent!  Why on earth did I think AM was the code for displaying AM/PM?  lol

    Featured Post

    Gigs: Get Your Project Delivered by an Expert

    Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

    Join & Write a Comment

    In .NET 2.0, Microsoft introduced the Web Site.  This was the default way to create a web Project in Visual Studio 2005.  In Visual Studio 2008, the Web Application has been restored as the default web Project in Visual Studio/.NET 3.x The Web Si…
    IntroductionWhile developing web applications, a single page might contain many regions and each region might contain many number of controls with the capability to perform  postback. Many times you might need to perform some action on an ASP.NET po…
    Sending a Secure fax is easy with eFax Corporate ( First, Just open a new email message.  In the To field, type your recipient's fax number You can even send a secure international fax — just include t…
    This video discusses moving either the default database or any database to a new volume.

    754 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

    19 Experts available now in Live!

    Get 1:1 Help Now