none
how to get Now() formated with millisecond ? RRS feed

  • Question

  • Dear all,

    I need to get the date time return by NOW(9 to be formatted using milliseconds as well, what is the way to do that using VBA ?

    thnaks for advide

    regards

    Monday, April 15, 2019 12:13 PM

Answers

  • The VBA function Now doesn't return milliseconds. You can use the Timer function for this purpose, for example:

    Dim s As String
    s = Format(Now, "yyyy-mm-dd hh:mm:ss") & Right(Format(Timer, "0.000"), 4)

    P.S. the last digit will always be 0.


    Regards, Hans Vogelaar (http://www.eileenslounge.com)

    • Marked as answer by wakefun Tuesday, April 16, 2019 7:58 AM
    Monday, April 15, 2019 2:52 PM