Welcome to SPN

Register and Join the most happening forum of Sikh community & intellectuals from around the world.

Sign Up Now!

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

Discussion in 'Information Technology' started by k, Jul 28, 2006.

  1. k

    k
    Expand Collapse
    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?
     
  2. Loading...

    Similar Threads Forum Date
    Extract from Steppenwolf, and the reason I do not socialise... Blogs Oct 17, 2015
    Extract: The untold history of Sikh Rule under Ranjit Singh Ji in Lahore Sikh Personalities May 28, 2014
    Indian Americans Pioneering Cancer Research from Herbal Extracts Health & Nutrition Jan 25, 2011
    Extracts of conversation Interfaith Dialogues Dec 15, 2007

  3. Al Camp

    Al Camp
    Expand Collapse
    Guest

    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.

    --
    hth
    Al Camp
    Candia Computer Consulting - Candia NH
    http://home.comcast.net/~cccsolutions


    "k" <k@discussions.microsoft.com> wrote in message
    news:3A32C68A-555B-4C99-90BB-5977ACB15FC0@microsoft.com...
    >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?
     
  4. k

    k
    Expand Collapse
    Guest

    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?


    "Al Camp" wrote:

    > 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.
    >
    > --
    > hth
    > Al Camp
    > Candia Computer Consulting - Candia NH
    > http://home.comcast.net/~cccsolutions
    >
    >
    > "k" <k@discussions.microsoft.com> wrote in message
    > news:3A32C68A-555B-4C99-90BB-5977ACB15FC0@microsoft.com...
    > >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?

    >
    >
    >
     
  5. Jerry Porter

    Jerry Porter
    Expand Collapse
    Guest

    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
     

Share This Page