What's the quickest way to copy the current date and time to clipboard?

1

1

I want to paste the current date and time to a spreadsheet and I am using the NOW() function and copy from there and paste as string but there might be a faster way. There might be an excel solution but a windows solution would be nice too becaue the problem/need isn't really excel specific.

Uğur Gümüşhan

Posted 2019-02-23T12:53:13.567

Reputation: 1 216

Answers

2

Using Excel, you can use following keyboard shortcuts

  • Ctrl+; enters the current date
  • Ctrl+: enters the current time

Edit cudo's to @phuclv for the missing requirement

Using plain windows, you could use

  • Win+R cmd /c date /t | clip
  • Win+R cmd /c time /t | clip

Lieven Keersmaekers

Posted 2019-02-23T12:53:13.567

Reputation: 1 088

But that doesn't copy the date to clipboard – phuclv – 2019-02-23T15:48:18.577

Also that doesn't work on my keyboard layout – Uğur Gümüşhan – 2019-02-23T15:56:24.633

Ive found a shortcut for my layout, it's ctrl+shift+; and ctrl+shitft+: (turkish-Q) – Uğur Gümüşhan – 2019-02-23T15:58:47.813

@phuclv - Enter the value and follow up with Ctr-C – Lieven Keersmaekers – 2019-02-24T11:25:13.583

2

Step 1: Open Notepad
Step 2: Hit F5
Step 3: Ctrl+A (to select all) then Ctrl+C (to copy)

Thirumalai Parthasarathy

Posted 2019-02-23T12:53:13.567

Reputation: 31

That's nice. I had no idea. – Lieven Keersmaekers – 2019-02-25T09:47:43.990

1

To answer the question, it depends which part(s) you want.

If it is just to copy to the clipboard, an executed VBS file would do it.

If it is to put the value into an Excel worksheet, an all VBA solution would suffice. When doing that, I would add the value and then set the numeric format. If you actually wanted a string, it could be: [A1] = Format(date+time, "mm/dd/yyyy hh:mm AM/PM")

Kenneth Hobson

Posted 2019-02-23T12:53:13.567

Reputation: 11

Excel already has that feature. Don't create a VBA solution just for entering the date or time. See Insert the current date and time in a cell https://superuser.com/a/1358759/241386

– phuclv – 2019-02-24T12:46:17.687

0

This will work system-wide:

  1. Right-clcik on the Desktop > New > Shortcut.
  2. Copy & paste the following for the target:

powershell -WindowStyle Hidden -Command "Get-Date | set-clipboard"

  1. Assign a shortcut key (Sign out/sign in required to take effect)

Drawbacks:

  • Screen flash even with WindowStyle set to Hidden.
  • Working window loses focus.

Keith Miller

Posted 2019-02-23T12:53:13.567

Reputation: 1 789