+ Reply to Thread
Results 1 to 3 of 3

Returning the Time part from NOW()

  1. #1
    Forum Contributor
    Join Date
    11-28-2008
    Location
    Reykjavík, Iceland
    MS-Off Ver
    Any of: 2003 & 2007
    Posts
    412

    Returning the Time part from NOW()

    Hi,

    It is known that NOW() presents Date & Time.

    Date as a whole number and Time as a decimal fracture.

    In a sheet, the formula: =MOD(NOW(),1) returns 0.430956597 for 10:20 AM (which is OK).

    When I try, this: T = Now Mod 1 (in VBA) T returns 'zero'.

    Is there an educational explanation for this behavior ?

    Thanks, Elm
    Last edited by ElmerS; 04-08-2010 at 04:08 AM.

  2. #2
    Forum Guru DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Northumberland, UK
    MS-Off Ver
    O365
    Posts
    21,531

    Re: Returning the Time part from NOW()

    In VBA use TIME statement.

    Per the VBA Help files you will find MOD in VBA works with whole numbers.
    Last edited by DonkeyOte; 04-08-2010 at 03:33 AM. Reason: (statement - not function)

  3. #3
    Forum Contributor
    Join Date
    11-28-2008
    Location
    Reykjavík, Iceland
    MS-Off Ver
    Any of: 2003 & 2007
    Posts
    412

    Re: Returning the Time part from NOW()

    Thank you.

    I'm familar with TIME.

    This was an "understandig" question as per the "strange behavior" of MOD in VBA.

    Everything clear now.

    Elm.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1