Current time and date in excel

The current date and time is a very common piece of data needed in a lot of Excel solutions.

The great news is there a lot of ways to get this information into Excel.

In this post, we’re going to look at 5 ways to get either the current date or current time into our workbook.

Video Tutorial

Keyboard Shortcuts

Excel has two great keyboard shortcuts we can use to get either the date or time.

These are both quick and easy ways to enter the current date or time into our Excel workbooks.

The dates and times created will be current when they are entered, but they are static and won’t update.

Current Date Keyboard Shortcut

Pressing Ctrl + ; will enter the current date into the active cell.

This shortcut also works while in edit mode and will allow us to insert a hardcoded date into our formulas.

Current Time Keyboard Shortcut

Pressing Ctrl + Shift + ; will enter the current time into the active cell

This shortcut also works while in edit mode and will allow us to insert a hardcoded date into our formulas.

Functions

Excel has two functions that will give us the date and time.

These are volatile functions, which means any change in the Excel workbook will cause them to recalculate. We will also be able to force them to recalculate by pressing the F9 key.

This means the date and time will always update to the current date and time.

TODAY Function

= TODAY()

This is a very simple function and has no arguments.

It will return the current date based on the user’s PC settings.

This means if we include this function in a workbook and send it to someone else in a different time zone, their results could be different.

NOW Function

= NOW()

This is also a simple function with no arguments.

It will return the current date and time based on the user’s PC date and time setting.

Again, someone in a different time zone will get different results.

Power Query

In Power Query, we only have one function to get both the current date and current time. We can then use other commands to get either the date or time from the date-time.

We first need to add a new column for our date-time. Go to the Add Column tab and create a Custom Column.

= DateTime.LocalNow()

In the Custom Column dialog box.

  1. Give the new column a name like Current DateTime.
  2. Enter the DateTime.LocalNow function in the formula section.
  3. Press the OK button.

Extract the Date

Now that we have our date-time column, we can extract the date from it.

We can select the date-time column ➜ go to the Add Column tab ➜ select the Date command ➜ then choose Date Only.

= Table.AddColumn(#"Added Custom", "Date", each DateTime.Date([Current DateTime]), type date)

This will generate a new column containing only the current date. Power query will automatically generate the above M code with the DateTime.Date function to get only the date.

Extract the Time

We can also extract the time from our date-time column.

We can select the date-time column ➜ go to the Add Column tab ➜ select the Time command ➜ then choose Time Only.

= Table.AddColumn(#"Added Custom", "Time", each DateTime.Time([Current DateTime]), type time)

This will generate a new column containing only the current time. Power query will automatically generate the above M code with the DateTime.Time function to get only the time.

Power Pivot

With power pivot, there are two ways to get the current date or time. We can create a calculated column or a measure.

To use power pivot, we need to add our data to the data model first.

  1. Select the data.
  2. Go to the Power Pivot tab.
  3. Choose the Add to Data Model command.

Power Pivot Calculated Column

A calculated column will perform the calculation for each row of data in our original data set. This means we can use the calculated column as a new field for our Rows or Columns area in our pivot tables.

= TODAY()
= NOW()

It turns out Power Pivot has the exact same TODAY and NOW functions as Excel!

We can then add a new calculated column inside the power pivot add in.

  1. Double click on the Add Column and give the new column a name. Then select any cell in the column and enter the TODAY function and press Enter.
  2. Go to the Home tab ➜ Change the Data Type to Date ➜ Change the Format to any of the date formats available.

We can do the exact same to add our NOW function to get the time and then format the column with a time format.

Power Pivot Measure

Another option with power pivot is to create a measure. Measures are calculations that aggregate to a single value and can be used in the Values area of a pivot table.

Again, we can use the same TODAY and NOW functions for our measures.

Add a new measure.

  1. Go to the Power Pivot tab.
  2. Select the Measures command.
  3. Select New Measure.

This will open up the Measure dialog box where we can define our measure calculation.

  1. Give the new measure a name.
  2. Add the TODAY or NOW function to the formula area.
  3. Select a Date Category.
  4. Select either a date or time format option.
  5. Press the OK button.

Now we can add our new measure into the Values area of our pivot table.

Power Automate

If you’re adding or updating data in Excel through some automated process via Power Automate, then you might want to add a timestamp indicating when the data was added or last updated.

We can definitely add the current date or time into Excel from Power Automate.

We will need to use an expression to get either the current date or time. Power Automate expressions for the current time will result in a time in UTC which will then need to be converted into the desired timezone.

= convertFromUtc(utcNow(),'Eastern Standard Time','yyyy-MM-dd')

This expression will get the current date in the EST timezone. You can find a list of all the timezone’s here.

= convertFromUtc(utcNow(),'Eastern Standard Time','hh:mm:ss')

This expression will get the current time in the EST timezone.

Conclusions

Like most things in Excel, there are many ways to get the current date and time in Excel.

Some are static like the keyboard shortcuts. They will never update after entering them, but this may be exactly what we need.

The other methods are dynamic but need to be recalculated or refreshed.

Do you have any other methods? Let me know in the comments!

About the Author

John MacDougall

John is a Microsoft MVP and qualified actuary with over 15 years of experience. He has worked in a variety of industries, including insurance, ad tech, and most recently Power Platform consulting. He is a keen problem solver and has a passion for using technology to make businesses more efficient.

The easiest and fastest way to enter into the cell current date or time — is to click the hotkey combination CTRL + «;» (today’s date) and CTRL + SHIFT + «;» (the current time).

To use the TODAY () function is much better. It not only states but also automatically updates the information of the cell every day without user intervention.



How to put the current date in Excel

To insert the current date in Excel a person should use the function TODAY (). To do this, select the tool «FORMULAS»-«Date & Time»-«TODAY». This function has no arguments, so you can just type in a cell «=TODAY()» and press ENTER.

The current date in a cell:

TODAY.

If it is necessary to update automatically not only the current date, but the time in the cell, you’d better use the function «=NOW()».

NOW.

The current date and time in a cell.



The way to set the current date into the running title in Excel

Inserting the current date in Excel is implemented in several ways:

  1. By setting the parameters of the running title. The advantage of this method is that the current date and time are put on all the pages at once simultaneously.
  2. Using the function TODAY ().
  3. Using the hotkey combination CTRL +; — To set the current date and CTRL + SHIFT +; — To set the current time. The disadvantage in this process is that it will not be automatically updated to the current value of the cell parameters, the document is opened. But in some cases, lack of data is an advantage.
  4. With the help of VBA macros using the function code of the program: Date();Time();Now();.

The running title allows you to set the current date and time in the top or bottom of pages in the document to be output to the printer. In addition, the header allows us to enumerate all the pages of the document.

To make the current date in Excel and enumerate the pages with the help of the running page you should:

  1. Open the «PAGE LAYOUT»-«Page Setup» tab and select «Header/Footer».
  2. Page Setup.

  3. Click on the button to create «Custom Footer».
  4. Custom Footer.

  5. In the window that appears, click on the field «Center section:». On the panel, click the second button, «Insert Number of Pages». Then select the first button «Format Text» and set the format to display the page number (for example, bold and font size of 14 points).
  6. To set the current date and time, click on the field «Right section:» and then click «Insert Date» (if necessary, click on the «Insert Time»). Click OK in both dialog boxes. In these fields you can enter your text.
  7. Insert Time.

  8. Click OK, and look at the preliminary results display header. Below dropdown list «Footer:»
  9. Footer.

  10. «VIEW»-«Page Layout» menu, go to the preview of headers and footers. You can edit them there.

Edit them there.

Running titles allow us not only to set the date and page number. You can also add a space for the signature of the responsible person for the report. For example, the edit is now the lower left part of the page in the running titles:

Running titles.

Thus, it is possible to create documents with a comfortable place for signatures and seals on each page automatically.

The NOW function takes no arguments; it is entered with empty parentheses. When you enter the NOW function in a cell, it will display the current date and time. Each time the worksheet is recalculated or opened, the date and time will be updated. To display only the time component, format the cell using a time format. If you want to display the only the date, you can format the cell with a date format that does not display time, or you can use the TODAY function, which only inserts the date component.

Fixed time

If you need to insert the current date and time in a way that will not change, use the keyboard shortcut Ctrl + ‘

This shortcut will insert the current time in a cell as a value that will not automatically change. If you need to insert both the date and time in a cell, use the keyboard shortcut Ctrl + ; Then enter a space character and press Ctrl + Shift + ;

Year, Month, Day | Date Function | Current Date & Time | Hour, Minute, Second | Time Function

To enter a date in Excel, use the «/» or «-» characters. To enter a time, use the «:» (colon). You can also enter a date and a time in one cell.

Date and Time in Excel

Note: Dates are in US Format. Months first, Days second. This type of format depends on your windows regional settings. Learn more about Date and Time formats.

Year, Month, Day

To get the year of a date, use the YEAR function.

Year Function

Note: use the MONTH and DAY function to get the month and day of a date.

Date Function

1. To add a number of days to a date, use the following simple formula.

Add Days

2. To add a number of years, months and/or days, use the DATE function.

Add Years, Months and Days

Note: the DATE function accepts three arguments: year, month and day. Excel knows that 6 + 2 = 8 = August has 31 days and rolls over to the next month (23 August + 9 days = 1 September).

Current Date & Time

To get the current date and time, use the NOW function.

Now Function

Note: use the TODAY function to enter today’s date in Excel.

Hour, Minute, Second

To return the hour, use the HOUR function.

Hour Function

Note: use the MINUTE and SECOND function to return the minute and second.

Time Function

To add a number of hours, minutes and/or seconds, use the TIME function.

Add Hours, Minutes and Seconds

Note: Excel adds 2 hours, 10 + 1 = 11 minutes and 70 — 60 = 10 seconds.

Понравилась статья? Поделить с друзьями:
  • Current document in word
  • Current date with time in excel
  • Currency number to word
  • Currency exchange in excel
  • Cure for all diseases one word