Results 1 to 2 of 2

Thread: Time data type in vba

  1. #1
    Board Regular
    Join Date
    Mar 2016
    Posts
    1,438
    Post Thanks / Like
    Mentioned
    7 Post(s)
    Tagged
    0 Thread(s)

    Default Time data type in vba

    Hi
    The code below worsk but I wonder why vBA does not have Time type. Is not Date and Time format different?
    I defined x here as a Date but then assign Time function to it. It did work but wondering why there is not Time type. Thank you very much

    Code:
    Sub mytime()
        Dim xtime As Date
        xtime = Time
        MsgBox xtime
    End Sub

  2. #2
    MrExcel MVP
    Join Date
    May 2009
    Posts
    16,590
    Post Thanks / Like
    Mentioned
    39 Post(s)
    Tagged
    9 Thread(s)

    Default Re: Time data type in vba

    Time is the part of the serial date number that indicates what fraction of the current day has elapsed. At noon today the serial date number is 43747.5 which can be formatted to: 10/9/2019 12:00 PM
    Joe

    When I was a young man I knew everything. Now that I'm older, I realize I know very little, and what I do know, I tend to forget!

Some videos you may like

User Tag List

Tags for this Thread

Like this thread? Share it with others

Like this thread? Share it with others

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •