How to write macro which evaluates =Now() and inserts result (revisted)

This question was asked before:

While the answer given seemed to satisfy the original questioner, I need a fuller answer.

Ctrl+: yields something like > 03/17/26
and Ctrl+Shft+; yields something like > 16:36:01.8890805
However, I need something like > 03/17/2026 15:57:37

I can currently get that by copying a cell containing =now() and then Ctrl+Shft+v. A little tedious but works.

What I want is a hot key that would give the same result. Ideally, I would like replace the current Ctrl+; with a Insert Date and Time function, instead of just insert date.

Thank you, keme1, for the suggestion. Unfortunately LibreOffice doesn’t allow me to use both shortcuts in the same cell.

Not sure why Ctrl+; followed by Shft+Ctrl+; didn’t work.

But I played with the short cuts and added Ctrrl+Alt+; to Insert Time.

I was then able to use the combo Ctrl+; followed by Ctrl+Alt+;

But, that creates a new problem, it breaks my cell formatting. So not sure if I have a solution and a new problem or if I should continue to look for a solution.

I think I will continue to look for another solution here.

This third party page has a macro, https://superuser.com/questions/1345629/insert-the-current-date-and-time-datetime-function-with-a-single-shortcut-into

I see that Mac does not appear to have a shortcut to insert Time in the Calc Guide 25.2

That’s weird. It works for me after a recent auto update to 25.8.5.2, and also worked on a previous version (25.6.something I believe) before I replied. My shortcuts on Norwegian language/keyboard setup are slightly different from what you specified, but that should not be a problem.

  • My tests were on Windows 11.
  • Initially Calc displayed overflow indicator #### in the cell, so I had to make it wider to view the full date/time display. Other than that it worked smoothly.
1 Like

This can easily be done with a macro and assigned a hotkey.
What cell format do you need for the current date and time?

You can combine the two keypresses.

  • First press the date keyboard shortcut Ctrl+;
  • Next, immediately press the time-of-day shortcut Ctrl+Shift+;

You achieve the desired output - full four digit year, hour:min:sec without fractions of a second - by formatting the timestamp cell accordingly.