Display Today’s Date & Time in VBA

Function used to displaz the current date / time is Vba.Now()

This function will return the date & time in this default format: 7/14/2029 11:34:31 AM

The returned output can be formatted into any desired format as given in the below code snippet.

Sub get_current_date_time()
    'Code from Officetricks
    Dim iDate As Date
    'Get Current Date & Time
    iDate = VBA.Now
    'Display Output
    MsgBox "Unformatted: " & iDate
    MsgBox "Formatted: " & VBA.Format(iDate, "dd-mmm-yyyy")
End Sub

If not a macro, a simple formula can also fetch this date value.

Excel Formula to get Date & Time

Use on of thes formula:

  1. =Today()
  2. =Now()

The first one, is self explanatory. It will fetch only the date in the system specific format.

The next one is similar to the Vba function. It return date, time, AM/PM etc.,

In Excel, the date can be formatted using the =Text command. This function works very similar to the “vba.Format” command.

You have to provide the date value & the desired format string.

So, that is all about getting Current Date & Time in Excel.