Excel Macro : How can I get the timestamp in "yyyy-MM-dd hh:mm:ss" format?

Try with: format(now(), "yyyy-MM-dd hh:mm:ss")


DateTime.Now returns a value of data type Date. Date variables display dates according to the short date format and time format set on your computer.

They may be formatted as a string for display in any valid date format by the Format function as mentioned in aother answers

Format(DateTime.Now, "yyyy-MM-dd hh:mm:ss")