Windows Vista Forums

Include AM or PM using DatePart Function
  1. #1


    Len Guest

    Include AM or PM using DatePart Function

    I do not know how to extract the AM or PM in the DatePart Function

    My Code is:

    <%
    tmCurrentTime = Now()
    tmCurrentTime = DatePart("h",tmCurrentTime) & ":" &
    DatePart("n",tmCurrentTime)
    %>



    This works, but I do not know how to get the AM or PM.

    If DatePart("h",tmCurrentTime) is 4, how do I know if it is AM or PM?

    Thanks for the help.

    Len


      My System SpecsSystem Spec

  2. #2


    James Whitlow Guest

    Re: Include AM or PM using DatePart Function

    "Len" <Len@xxxxxx> wrote in message
    newsF5AE6E6-CB72-451F-A6BF-EE57A8C0B34B@xxxxxx

    >I do not know how to extract the AM or PM in the DatePart Function
    >
    > My Code is:
    >
    > <%
    > tmCurrentTime = Now()
    > tmCurrentTime = DatePart("h",tmCurrentTime) & ":" &
    > DatePart("n",tmCurrentTime)
    > %>
    >
    > This works, but I do not know how to get the AM or PM.
    >
    > If DatePart("h",tmCurrentTime) is 4, how do I know if it is AM or PM?
    It should return the hour of the day starting from midnight. In your
    example above, it should return '4' for 4 AM and '16' for 4 PM.



      My System SpecsSystem Spec

Include AM or PM using DatePart Function problems?

Similar Threads
Thread Thread Starter Forum Replies Last Post
Request for DatePart test in Win7; need only read a Web page Dr J R Stockton VB Script 1 23 Feb 2010
Script that uses the DatePart & Case select David Rodriguez VB Script 0 16 Jul 2009
Week number with DatePart syntax, and Server... Benny Pedersen VB Script 6 24 Nov 2008
BUG: Redirecting function contents to a file truncates function lines at the width of the console Adam Milazzo PowerShell 2 11 Aug 2006
Tab Completion customization to include function search? Alex K. Angelopoulos [MVP] PowerShell 5 05 Jun 2006