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

Parth Bhatt picture Parth Bhatt · Mar 28, 2011 · Viewed 297.6k times · Source

I am using DateTime.Now in my Excel Macro to show the current timestamp.

It shows timestamp in "dd-MM-yyyy hh:mm:ss" format.

Instead, how can I get the timestamp in "yyyy-MM-dd hh:mm:ss" format?

Answer

Mohamed Saligh picture Mohamed Saligh · Mar 28, 2011

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