Convert Time "12:00:00 AM" into "12:00"

A

ali

I have a table with time in this format "12:00:00 AM".


I 'd like to extract the time in these two formats

1) 12:00 (12-hour)
2) 12:00 (24-hour)

Thanks a lot, dear experts !
 
R

Rick Brandt

ali said:
I have a table with time in this format "12:00:00 AM".


I 'd like to extract the time in these two formats

1) 12:00 (12-hour)
2) 12:00 (24-hour)

Tables don't store formatted values. They just have default format properties
that dictate how they will show them on the screen. Just use a different format
property wherever you are displaying them.

I don't think you can display a 12 hour format without having am/pm unless you
use the format function to produce a text string from your value and then strip
the am/pm off of that (as below). Of course that means what you have left is
now an actual string. It will not sort like a DateTime nor can you easily
perform DateTime functions on it.

=Left(Format([yourField], "hh:nn ampm"),4)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top