Problems formatting output from SQL DateTime Field

Posted on 2009-02-17
Medium Priority
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
  • 2
LVL 11

Expert Comment

ID: 23660998

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

Accepted Solution

jmwheeler earned 2000 total points
ID: 23661007
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.

Author Closing Comment

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

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

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

Hello, all! I just recently started using Microsoft's IIS 7.5 within Windows 7, as I just downloaded and installed the 90 day trial of Windows 7. (Got to love Microsoft for allowing 90 days) The main reason for downloading and testing Windows 7 is t…
I recently went through the process of creating a Calendar Control of events with the basis of using a database to keep track of the dates that are selectable, one requirement was to have the selected date pop-up in a simple lightbox.  At first this…
Screencast - Getting to Know the Pipeline
With just a little bit of  SQL and VBA, many doors open to cool things like synchronize a list box to display data relevant to other information on a form.  If you have never written code or looked at an SQL statement before, no problem! ...  give i…
Suggested Courses

807 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