Please Note: This article is written for users of the following Microsoft Excel versions: 2007, 2010, and 2013. If you are using an earlier version (Excel 2003 or earlier), this tip may not work for you. For a version of this tip written specifically for earlier versions of Excel, click here: Inserting the Current Time with Seconds.

Inserting the Current Time with Seconds

by Allen Wyatt
(last updated October 25, 2014)

13

As you have learned in other ExcelTips, you can use Ctrl+: (that's a colon) to enter the current time into a cell. The resulting cell value is equal to the hours and minutes of the current time. In other words, the seconds will always be zero.

If you want to insert the current time and have it include the seconds, the best way is to use a macro. You can then assign the macro to a keyboard shortcut or a toolbar button (or both) so it can be immediately popped into place. The following macro will do the trick nicely:

Sub TimeStamp()
    ActiveCell.Value = Time
    ActiveCell.NumberFormat = "h:mm:ss AM/PM"
End Sub

Notice that the time is placed in the cell and then the cell is formatted to show hours, minutes, and seconds.

ExcelTips is your source for cost-effective Microsoft Excel training. This tip (10635) applies to Microsoft Excel 2007, 2010, and 2013. You can find a version of this tip for the older menu interface of Excel here: Inserting the Current Time with Seconds.

Author Bio

Allen Wyatt

With more than 50 non-fiction books and numerous magazine articles to his credit, Allen Wyatt is an internationally recognized author. He  is president of Sharon Parq Associates, a computer and publishing services company. ...

MORE FROM ALLEN

Formatting Page Numbers

Need to format the page numbers you added to your document? Word makes it easy, using the same techniques you use to format ...

Discover More

Saving All Open Documents

Got a lot of open documents you are working with? You can save them all at one time by adding a handy tool to your Quick ...

Discover More

Copying Styles

Styles can make your worksheet formatting easier and more consistent. Here's how to copy styles from an existing workbook to ...

Discover More

Professional Development Guidance! Four world-class developers offer start-to-finish guidance for building powerful, robust, and secure applications with Excel. The authors show how to consistently make the right design decisions and make the most of Excel's powerful features. Check out Professional Excel Development today!

More ExcelTips (ribbon)

Specifying Location for a Message Box

When writing macros, you may want to position a message box at a specific location on the screen. This can't be done in ...

Discover More

Finding Columns of a Certain Width

If you need to find out how many columns are set to be a specific width, you'll need a macro to help determine the info. ...

Discover More

Specifying a Delimiter when Saving a CSV File in a Macro

You can, within a macro, save a workbook in several different file formats that are understood by Excel. However, you may not ...

Discover More
Subscribe

FREE SERVICE: Get tips like this every week in ExcelTips, a free productivity newsletter. Enter your address and click "Subscribe."

View most recent newsletter.

Comments

If you would like to add an image to your comment (not an avatar, but an image to help in making the point of your comment), include the characters [{fig}] in your comment text. You’ll be prompted to upload your image when you submit the comment. Maximum image size is 6Mpixels. Images larger than 600px wide or 1000px tall will be reduced. Up to three images may be included in a comment. All images are subject to review. Commenting privileges may be curtailed if inappropriate images are posted.

What is four less than 9?

2017-08-19 06:18:08

Willy Vanhaelen

@Walt
Perhaps the macro solution in this tip is what you are looking for:
https://excelribbon.tips.net/T013233_Automatically_Entering_a_Data_Entry_Time.html

If so see also my comment of 2016-02-21 there.


2017-08-18 11:45:52

Walt

I am creating a spreadsheet for co-workers to use that have little or no excel experience. In order to make it easy for them I am trying to insert the current date and time in a cell to record when an action occurred. That date and time must remain and not change.

I have been able to insert a calendar to select a date. I cannot find a way to insert the actual time that will remain static. I also cannot find a 'clock' that actually keeps current time. What I've inserted is a time that doesn't change.

It seems like I need VBA code to do this. Any thoughts.


2017-05-24 17:26:08

Fradi

Great


2017-03-08 19:29:40

HARINATH KOTLA

Thank you


2017-02-18 12:19:16

Peter Atherton

Rick

Unless you prefer the 24 hour clock and use "[h]:mm:ss"


2017-02-17 14:40:14

Lisa

Brilliant! This is just what I needed for my project! Thank you!


2016-12-10 05:45:35

Rick Rothstein

I am confused. When I run the macro without that NumberFormat line of code, the time still goes into the cell correctly, with the seconds, and the cell's format is changed to Custom "h:mm:ss AM/PM" automatically. I do not see why you thought you needed to manually format the cell via the macro. If it makes a difference, I am using XL2010 on Win 8.1.


2015-03-30 14:49:12

Jake

HAHA exactly what I was looking for. A lot of other sites either gave the NOW() or Ctr + : tips but those were useless for a person who needed the seconds. Very easy and now I get to say I made a macro. (Fist pump)


2015-01-09 09:06:57

Mike O\'Neill

Hi. I posted this tip on the Excel 2007 page, now repeating it here: If you do not want to use macros, or are unable to, then a simple but less elegant option is to enter the formula
=NOW()
in the formula bar, then immediately press f9 <Enter> to fix the value. Make sure that the cells in the column or cell are formatted to show the time in seconds.

It is a short formula so not too much work. But if you need to do it multiple times you could first copy the =NOW() into the copy buffer, then use the following sequence of keystrokes to paste into the formula bar as follows:
<F2> <Paste> <F9> <Enter>

(Where <Paste> is Ctrl-V or equivalent)


2014-10-26 09:51:26

BHershman

Michael (Micky) Avidan:

You are quite right. I misread the hint.


2014-10-26 06:57:59

Michael (Micky) Avidan

@BHershman,
The tip says very clearly:
you can use Ctrl+: (that's a colon) to enter the current time into a cell. The resulting cell value is equal to the hours and minutes of the current time. In other words, the seconds will always be zero.
Watch, carefully, the last 9 words.
Any "Date/Time" worksheet function is Volatile - and as such will be re-calculate upon every sheet recalculation.
The only way to insert and PRESERVE(!) the current Date/Time is with VBA Code.
Michael (Micky) Avidan
“Microsoft® Answers" - Wiki author & Forums Moderator
“Microsoft®” MVP – Excel (2009-2015)
ISRAEL


2014-10-25 19:32:28

Peter Atherton

The trouble with Ctrl+: is that it is formatted to the nearest minute. The macro inserts the time value so will not recalculate. Also by assigning a Keyboard shortcut of say Ctrl+T it is no harder to enter than the Excel Function


2014-10-25 14:25:25

BHershman

The macro is not strictly necessary.

If you use the "=NOW()" formula or the "Ctrl+:" shortcut in a cell or column already formatted to show seconds, that is exactly what it will do.

Incidentally:
(1) When you put the current time into a cell by any of these methods, there is a good chance that by the time it is displayed in the cell the seconds will no longer be right.
(2) How do you ensure that cells holding the current time formula do not recalculate whenever the worksheet is itself recalculated?

If that is not what you want, you must use the "Ctrl+:" shortcut


This Site

Got a version of Excel that uses the ribbon interface (Excel 2007 or later)? This site is for you! If you use an earlier version of Excel, visit our ExcelTips site focusing on the menu interface.

Newest Tips
Subscribe

FREE SERVICE: Get tips like this every week in ExcelTips, a free productivity newsletter. Enter your address and click "Subscribe."

(Your e-mail address is not shared with anyone, ever.)

View the most recent newsletter.