Welcome to SPN

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

Sign Up Now!

Converting time using CDate function

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

  1. pete2586

    pete2586
    Expand Collapse
    Guest

    I'm trying to convert a string to a time using the CDate function. However, I
    can't get it to work. The date is in 24-hour format. Part of the code is
    shown below:

    timev = Hr & ":" & Min & ":00"
    rcs1(4) = timev

    Do I need to specify somehow that the time is in 24-hour format?

    Thanks
     
  2. Loading...

    Similar Threads Forum Date
    Jehovah's Witnesses Are Out And Converting! Blogs Jul 31, 2016
    Basic Questions about Converting to Sikhism Questions and Answers Nov 15, 2013
    Converting to Sikhism Hard Talk Aug 31, 2012
    Why are people converting to Sikhism? Sikh Sikhi Sikhism Jul 1, 2012
    Question About Converting To Sikhism For A Married Person Questions and Answers Jun 3, 2012

  3. Brendan Reynolds

    Brendan Reynolds
    Expand Collapse
    Guest

    Below are two examples, one using CDate, the other using TimeSerial. Using
    TimeSerial is probably the safer, less ambiguous option. See the help topic
    'TimeSerial Function' for more information.

    ? CDate("13:35")
    13:35:00

    ? TimeSerial(13,35,0)
    13:35:00

    If you are storing these values in a Date/Time field, don't forget that a
    Date/Time field always includes a complete date and time. As you are not
    specifying the date part, it will default to 30 December, 1899.

    --
    Brendan Reynolds
    Access MVP


    "pete2586" <pete2586@discussions.microsoft.com> wrote in message
    news:85797AB2-A4A9-4679-A87C-2CA735B4161A@microsoft.com...
    > I'm trying to convert a string to a time using the CDate function.
    > However, I
    > can't get it to work. The date is in 24-hour format. Part of the code is
    > shown below:
    >
    > timev = Hr & ":" & Min & ":00"
    > rcs1(4) = timev
    >
    > Do I need to specify somehow that the time is in 24-hour format?
    >
    > Thanks
     

Share This Page