Convert times

Important notice for users of Office 2003    To continue receiving security updates for Office, make sure you're running Office 2003 Service Pack 3 (SP3). The support for Office 2003 ends April 8, 2014. If you’re running Office 2003 after support ends, to receive all important security updates for Office, you need to upgrade to a later version such as Office 365 or Office 2013. For more information, see Support is ending for Office 2003.

Let's say you want to find out how many hours there are in five and a half days, or how many days there are in 3.45 years, or how many months have passed between a beginning date and an ending date. There are several ways to convert times.

What do you want to do?

Convert between time units

Convert hours from standard time format (hours : minutes : seconds) to a decimal number

Convert hours from decimal number to the standard time format (hours : minutes : seconds)


Convert between time units

To do this task, use the CONVERT function.

If the CONVERT function is not available, install and load the Analysis ToolPak add-in.

ShowHow?

  1. On the Tools menu, click Add-Ins.
  2. In the Add-Ins available list, select the Analysis ToolPak box, and then click OK.
  3. If necessary, follow the instructions in the setup program.

Example

The example may be easier to understand if you copy it to a blank worksheet.

ShowHow to copy an example

  1. Create a blank workbook or worksheet.
  2. Select the example in the Help topic.

 Note   Do not select the row or column headers.

Selecting an example from Help

Selecting an example from Help
  1. Press CTRL+C.
  2. In the worksheet, select cell A1, and press CTRL+V.
  3. To switch between viewing the results and viewing the formulas that return the results, press CTRL+` (grave accent), or on the Tools menu, point to Formula Auditing, and then click Formula Auditing Mode.
 
1
2
A
Data
6
Formula Description (Result)
=CONVERT(A2,"day","hr") Convert 6 days to hours (144)
=CONVERT(A2,"hr","mn") Convert 6 hours to minutes (360)
=CONVERT(A2,"yr", "day") Convert 6 years to days (2191.5)

 Note   For conversions using a year, a year is treated as 365.25 days.

Function details

CONVERT

Top of Page Top of Page


Convert hours from standard time format (hours : minutes : seconds) to a decimal number

To do this task, use the INT function.

Example

The example may be easier to understand if you copy it to a blank worksheet.

ShowHow to copy an example

  1. Create a blank workbook or worksheet.
  2. Select the example in the Help topic.

 Note   Do not select the row or column headers.

Selecting an example from Help

Selecting an example from Help
  1. Press CTRL+C.
  2. In the worksheet, select cell A1, and press CTRL+V.
  3. To switch between viewing the results and viewing the formulas that return the results, press CTRL+` (grave accent), or on the Tools menu, point to Formula Auditing, and then click Formula Auditing Mode.
 
1
2
3
A
Time
10:35 AM
12:15 PM
Formula Description (Result)
=(A2-INT(A2))*24 Number of hours since 12:00 AM (10.583333)
=(A3-INT(A3))*24 Number of hours since 12:00 AM (12.25)

Function details

INT

Top of Page Top of Page


Convert hours from decimal number to the standard time format (hours : minutes : seconds)

To do this task, use the divisor operator (/) and the TEXT function.

Example

The example may be easier to understand if you copy it to a blank worksheet.

ShowHow to copy an example

  1. Create a blank workbook or worksheet.
  2. Select the example in the Help topic.

 Note   Do not select the row or column headers.

Selecting an example from Help

Selecting an example from Help
  1. Press CTRL+C.
  2. In the worksheet, select cell A1, and press CTRL+V.
  3. To switch between viewing the results and viewing the formulas that return the results, press CTRL+` (grave accent), or on the Tools menu, point to Formula Auditing, and then click Formula Auditing Mode.
 
1
2
3
A
Hours
10.5833
12.25
Formula Description (Result)
=TEXT(A2/24, "h:mm") Hours since 12:00 AM (10:35)
=TEXT(A3/24, "h:mm") Hours since 12:00 AM (12:15)

 Note   You can also apply the time number format without using the TEXT function to specify the format. To view the number as a time, select the cell and click Cells on the Format menu. Click the Number tab, and then click Time in the Category box. However, if you use both a format applied with the TEXT function and number format, the TEXT function takes precedence.

Function details

TEXT

Top of Page Top of Page

 
 
Applies to:
Excel 2003