The function that retrieves and then displays the date and time from your computer is the:

  • Login
  • Cart

  • Training
  • Videos
  • Functions
  • Formulas
  • Shortcuts
  • Blog

The function that retrieves and then displays the date and time from your computer is the:

Summary 

If you need to display the current date and time in a worksheet, you can use the NOW function. The date and time will update whenever the worksheet is recalculated or opened.

Explanation 

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 + ;

Related functions 

The function that retrieves and then displays the date and time from your computer is the:

The Excel NOW function returns the current date and time, updated continuously when a worksheet is changed or opened. The NOW function takes no arguments. You can format the value returned by NOW as a date, or as a date with time by applying a...

The function that retrieves and then displays the date and time from your computer is the:

Excel Formula Training

Formulas are the key to getting things done in Excel. In this accelerated training, you'll learn how to use formulas to manipulate text, work with dates and times, lookup values with VLOOKUP and INDEX & MATCH, count and sum with criteria, dynamically rank values, and create dynamic ranges. You'll also learn how to troubleshoot, trace errors, and fix problems. Instant access. See details here.

Download 100+ Important Excel Functions

Get over 100 Excel Functions you should know in one handy PDF.

Excel video training

Quick, clean, and to the point.

Learn more

Skip to main content

This browser is no longer supported.

Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.

GetTickCount function (sysinfoapi.h)

  • Article
  • 06/29/2021
  • 2 minutes to read

In this article

Retrieves the number of milliseconds that have elapsed since the system was started, up to 49.7 days.

Syntax

DWORD GetTickCount();

Return value

The return value is the number of milliseconds that have elapsed since the system was started.

Remarks

The resolution of the GetTickCount function is limited to the resolution of the system timer, which is typically in the range of 10 milliseconds to 16 milliseconds. The resolution of the GetTickCount function is not affected by adjustments made by the GetSystemTimeAdjustment function.

The elapsed time is stored as a DWORD value. Therefore, the time will wrap around to zero if the system is run continuously for 49.7 days. To avoid this problem, use the GetTickCount64 function. Otherwise, check for an overflow condition when comparing times.

If you need a higher resolution timer, use a multimedia timer or a high-resolution timer.

To obtain the time elapsed since the computer was started, retrieve the System Up Time counter in the performance data in the registry key HKEY_PERFORMANCE_DATA. The value returned is an 8-byte value. For more information, see Performance Counters.

To obtain the time the system has spent in the working state since it was started, use the QueryUnbiasedInterruptTime function.

Note  The QueryUnbiasedInterruptTime function produces different results on debug ("checked") builds of Windows, because the interrupt-time count and tick count are advanced by approximately 49 days. This helps to identify bugs that might not occur until the system has been running for a long time. The checked build is available to MSDN subscribers through the Microsoft Developer Network (MSDN) Web site.

Examples

// calculate a 't' value that will linearly interpolate from 0 to 1 and back every 20 seconds
DWORD currentTime = GetTickCount();
if ( m_startTime == 0 )
{
    m_startTime = currentTime;
}
float t = 2 * (( currentTime - m_startTime) % 20000) / 20000.0f;
if (t > 1.0f)
{
    t = 2 - t;
}

Requirements

  
Minimum supported client Windows 2000 Professional [desktop apps | UWP apps]
Minimum supported server Windows 2000 Server [desktop apps | UWP apps]
Target Platform Windows
Header sysinfoapi.h (include Windows.h)
Library Kernel32.lib
DLL Kernel32.dll

See also

Time Functions

Windows Time

What is the process of displaying only a portion of the data based on matching a specific value to show only the data that meets the criteria that you specify?

Filtering Data When data is filtered, only rows that meet the filter criteria will display and other rows will be hidden. With filtered data, you can then copy, format, print, etc., your data, without having to sort or move it first.

What is the term for the values that a function used to perform operations or calculations?

Functions are predefined formulas that perform calculations by using specific values, called arguments, in a particular order, or structure.

What is the Excel function that adds a group of values and then divides the result by the number of values in the group?

Average Function: an excel function that adds a group of values, and then divides the result by the number of values in the group.

What is the term used to describe an Excel function that is subject to change each time the workbook is opened?

Volatile. A term used to describe an Excel function that is subject to change each time the workbook is reopened; for example the NOW function updates itself to the current date and time each time the workbook is opened.