• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 392
  • Last Modified:

Problems formatting output from SQL DateTime Field

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...
0
Cerixus
Asked:
Cerixus
  • 2
1 Solution
 
jmwheelerCommented:
Use

{0:MMMM dd, yyyy hh:mm tt}
0
 
jmwheelerCommented:
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.
0
 
CerixusAuthor Commented:
Excellent!  Why on earth did I think AM was the code for displaying AM/PM?  lol
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Get your problem seen by more experts

Be seen. Boost your question’s priority for more expert views and faster solutions

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now