How do I extract the AM/PM from a time date stamp?

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I am able to extract the date in individual format and the time in the
individual format but I can not extract the AM/PM from this string. How do I
extract that part? I have tried using a and A for the AM/PM but that did not
work. Can anyone assist me with this issue?
 
K,
As long as that field contains Time info, a format of something like...
hh:nn a/p would give 10:00 a
hh:nn AM/PM would yield 10:00 AM
Check Format/Date and Time in Help.
 
K,
As long as that field contains Time info, a format of something like...
hh:nn a/p would give 10:00 a
hh:nn AM/PM would yield 10:00 AM
Check Format/Date and Time in Help.
 
The type of data that I am using looks like this: 4/3/2006 8:52:36 AM
I am working in a query pulling the different info in seperate fields to for
different fields like this: 4/3/2006
8:52:36 AM
The Am does not follow regardless of what I type in to try and extract it
from the data. The help sections talks about the basic format but these
tables were created prior to my employment and the format did not work. Do
you know of anything else that might work?
 
The type of data that I am using looks like this: 4/3/2006 8:52:36 AM
I am working in a query pulling the different info in seperate fields to for
different fields like this: 4/3/2006
8:52:36 AM
The Am does not follow regardless of what I type in to try and extract it
from the data. The help sections talks about the basic format but these
tables were created prior to my employment and the format did not work. Do
you know of anything else that might work?
 
K,

The AM/PM isn't part of the data, but is a result of formatting the
time for display purposes, which the query does automatically.

If you just want the AM or PM, try the following:

Right(Format(<date/time field>,"Medium Time"),2)

Replace <date/time field> by your field name.

This will format the date as a string ending in AM or PM, and then take
the last 2 characters.

You might be able to get away with just:

Right(<date/time field>,2)

Jerry
 

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

Back
Top