Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

HH:MM AM/PM Datetime format?

Status
Not open for further replies.

BeanDog

Programmer
Jul 15, 2000
60
US
I want to have my time data displayed like this:
12:30 AM
When I convert to default datetime format, it looks like:
12:30:00 AM
When I convert to short datetime format, it looks like:
00:30 AM

How can I get 12:30 AM?



~BenDilts( void );

~BenDilts( void );
benbeandogdilts@cs.com
Long-time BASIC game programmer, Internet programmer and C++/DirectX of late.
 
Use the format command:

eg.

Datevalue = 02/19/2001 03:45:34 PM

formated:
Format(Datevalue, "mm/dd/yyyy hh:nn AM/PM")
gives: 02/19/2001 03:45 PM

Format(Datevalue, "m/d/yy hh:nn AM/PM")
gives: 2/19/01 03:45 PM


Format(Datevalue, "m/d/yy hh:nn")
gives: 2/19/01 15:45

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top