4 Easy Ways to Add the Time and Date Automatically in Sheets

Download ArticleDownload Article

If you need to enter timestamps in Google Sheets, doing it manually can be a pain. Luckily, there are several shortcuts you can use to make the process easier. In this article, we’ll show you how to apply a simple script to your spreadsheet to add timestamps automatically, as well as formulas and keyboard shortcuts you can use to timestamp individual cells.

Method 1
Method 1 of 4:

Script Editor

Download Article
  1. How.com.vn English: Step 1 Click on Extensions.
    Using a script is an easy way to automatically insert timestamps into a Google Sheets spreadsheet. Once you apply the script, the rest of the process is fully automated. To get started, open your spreadsheet and click on the Extensions tab at the top of the window.[1]
  2. How.com.vn English: Step 2 Select Apps Script.
    In the dropdown Extensions menu, select the Apps Script option. This will open a new tab where you can create a script that will be bound to your spreadsheet.
    Advertisement
  3. How.com.vn English: Step 3 Give your script a name.
    At the top of the script editor window, you’ll see a box containing the default title Untitled project. Click the box and type in your own title to rename the script.[2]
    • It’s up to you what you want to call your timestamp script. Just choose something that makes sense for your project. For example, you could call it something like “AutoTimeandDate.”
  4. How.com.vn English: Step 4 Paste the code into the scripting window.
    In the Apps Script window, you will see a grey box containing a few lines of code, starting with function myFunction(). Delete whatever is in the box and replace it with a script that will insert a timestamp, such as this one:[3]
     /** @OnlyCurrentDoc */function onEdit(e){const sh = e.source.getActiveSheet();sh.getRange ('M' + e.range.rowStart).setValue (new Date()).setNumberFormat ('MM/dd/yyyy HH:MMam/pm');}
    • This particular script will insert a timestamp into the specified column any time you enter data into a cell, in the same row as the data you entered. For instance, if you type something into cell A2, a timestamp will appear in cell M2.
    • There are many different example scripts online that you can use for this purpose. Whichever one you choose, make sure to remove any smart quotes in the code and replace them with straight quotes, or the script won’t work properly.
  5. How.com.vn English: Step 5 Make any changes you like to the code.
    If you want to edit where and how the timestamp will appear in your spreadsheet, you can make adjustments to the script. For instance, in our example script, you can change which column the timestamp appears in as well as the format of the time and date.
    • The M in line 4 of the script indicates the column where the timestamp will appear. If you want it to appear in a different column, change it to whichever letter or column name you like (e.g., change M to B if you want the timestamp in column B).
    • You can also change the number format in line 7 to display just the time, if you like. Simply delete the MM/dd/yyy
  6. How.com.vn English: Step 6 Click Save.
    Once you’ve got the script the way you like it, hit the Save project button at the top of the Apps Script project window. This will apply the script to your Google spreadsheet.[4]
  7. How.com.vn English: Step 7 Enter data anywhere in your spreadsheet.
    Click back over to your Google Sheets tab and enter some data. The timestamp should appear in the same row, in whichever column you specified in your script.[5]
  8. Advertisement
Method 2
Method 2 of 4:

Time and Date Formulas

Download Article
  1. How.com.vn English: Step 1 Insert the formula =NOW() into a cell to display the time and date.
    Select the cell where you want to show the date and time, and type in =NOW(). This will cause the current date and time to appear in that cell.[6]
  2. Step 2 Use the formula =TEXT( NOW(), "hh:mm:ss" ) to show the current time.
    If you only want to show the timestamp and not the date, you can modify the formula using the TEXT() function. Copy and paste or type =TEXT( NOW(), "hh:mm:ss" ) into the cell where you want to display the time.[7]
    • If you prefer to display the time using a 24-hour clock instead of a 12-hour clock, capitalize HH in the formula.[8]
    • You can also add milliseconds by adding .000 after the ss at the end of the formula. That is, write the formula as =TEXT( NOW(), "hh:mm:ss.000" ).
    • Add AM/PM to the end of the formula if you’re using a 12-hour clock and want to indicate the time of day more accurately. Format the formula like this: =TEXT( NOW(), "hh:mm:ss AM/PM" ).
  3. How.com.vn English: Step 3 Change how often the timestamp updates in Settings.
    When you insert a timestamp using a formula, the time is not fixed. By default, it will update any time you make a change to the spreadsheet. While you can’t create a fixed timestamp using this method, you can modify how often it updates.[9] To do this:[10]
    • Open the File menu.
    • Select Settings to open the Settings for this spreadsheet dialog box.
    • Click on the Calculation tab.
    • Under the Recalculation heading, click on the dropdown menu and select how often you want the timestamp to update. The options are On change, On change and every minute, and On change and every hour.
    • Click Save settings to apply the change.
  4. How.com.vn English: Step 4 Use the General Settings to update your time zone.
    To make sure your formula displays the time correctly for your time zone, open the File menu and click Settings. In the Settings for this spreadsheet dialog box, click the General tab. Under Time zone, click the dropdown menu and select the correct time zone. When you’re done, click Save settings.[11]
    • You can also change your locale in the General Settings menu.
  5. Advertisement
Method 3
Method 3 of 4:

Keyboard Shortcuts (PC)

Download Article
  1. How.com.vn English: Step 1 Insert the time into a cell with Ctrl+⇧ Shift+;.
    Click on the cell where you want to display the time and press Ctrl+ Shift+; on your keyboard. This will display the current time in the format HH:MM:SS AM/PM in that cell.[12]
    • When you insert a timestamp using this shortcut, the time is fixed. It will reflect the time when you entered it and will not update if you make changes to the sheet.
  2. How.com.vn English: Step 2 Add the date using Ctrl+;.
    Use this shortcut to show just the date without the time in the selected cell. It will display the date in the format M/DD/YYYY.[13]
  3. How.com.vn English: Step 3 Use Ctrl+Alt+⇧ Shift+; to enter time and date.
    If you want to show both the time and date in a cell, select the cell and press the keys Ctrl+Alt+ Shift+;. This will display the time and date in the format M/DD/YYYY HH:MM:SS.[14]
  4. Advertisement
Method 4
Method 4 of 4:

Keyboard Shortcuts (Mac)

Download Article
  1. How.com.vn English: Step 1 Press ⌘ Command+⇧ Shift+; to enter the time in a cell.
    If you’re using Google Sheets on a Mac, select the cell where you want to display the time and press Command+ Shift+;. Just like on a PC, this will display a fixed timestamp in the format HH:MM:SS AM/PM.[15]
  2. How.com.vn English: Step 2 Insert the date with ⌘ Command+;.
    If you just want the cell to show the date and not the time, use the shortcut Command+;. The date will display in the format M/DD/YYYY.[16]
  3. How.com.vn English: Step 3 Input date and time with ⌘ Command+⌥ Option+⇧ Shift+;.
    This shortcut will show both the time and the date in the cell you selected, in the format M/DD/YYYY HH:MM:SS.[17]
  4. Advertisement

Expert Q&A

Ask a Question
200 characters left
Include your email address to get a message when this question is answered.
Submit
      Advertisement

      Video

      Tips

      Submit a Tip
      All tip submissions are carefully reviewed before being published
      Thanks for submitting a tip for review!

      About This Article

      How.com.vn English: Josef Storzi
      Written by:
      Apple & Mobile Phone Repair Specialist
      This article was written by Josef Storzi and by How.com.vn staff writer, Megaera Lorenz, PhD. Josef Storzi is an Apple and Mobile Phone Repair Specialist and the Owner of Imobile LA, a mobile phone repair company based in Los Angeles, California. Josef specializes in repairing screens, charging ports, batteries, water damage, speakers, and microphones on all mobile phone brands including Apple, Samsung, LG, Nokia, and Sony. He also specializes in tablet, laptop, and computer repairs as well as the pros and cons of recent mobile software updates. This article has been viewed 142,333 times.
      How helpful is this?
      Co-authors: 4
      Updated: April 12, 2024
      Views: 142,333
      Thanks to all authors for creating a page that has been read 142,333 times.

      Is this article up to date?

      ⚠️ Disclaimer:

      Content from Wiki How English language website. Text is available under the Creative Commons Attribution-Share Alike License; additional terms may apply.
      Wiki How does not encourage the violation of any laws, and cannot be responsible for any violations of such laws, should you link to this domain, or use, reproduce, or republish the information contained herein.

      Notices:
      • - A few of these subjects are frequently censored by educational, governmental, corporate, parental and other filtering schemes.
      • - Some articles may contain names, images, artworks or descriptions of events that some cultures restrict access to
      • - Please note: Wiki How does not give you opinion about the law, or advice about medical. If you need specific advice (for example, medical, legal, financial or risk management), please seek a professional who is licensed or knowledgeable in that area.
      • - Readers should not judge the importance of topics based on their coverage on Wiki How, nor think a topic is important just because it is the subject of a Wiki article.

      Advertisement