Return to Excel Formulas List
Download Example Workbook
Download the example workbook
This tutorial will demonstrate how to convert a time value to hours in Excel & Google Sheets.
Convert Time to Hours – Excel
Excel stores time as a decimal value where each 1/24th represents one hour of a day. Understanding this, you can convert a time to hours by multiplying the time by 24:
=B3*24
Format as Number
When you multiply time by 24, Excel may format the result as time (ex. h:mm):
To display the result as a regular number, change the formatting to General:
Convert Time to Hours in Google Sheets
All of the above examples work exactly the same in Google Sheets as in Excel.
Excel for Microsoft 365 Excel 2021 Excel 2019 Excel 2016 Excel 2013 Excel 2010 Excel 2007 More…Less
Let’s say you want to find out how many hours there are in 5.5 days, or how many days there are in 3.45 years, or how precisely how many months will pass between a beginning date and an ending date.
There are several ways to convert time units.
To convert from one time unit to another, use the CONVERT function.
Note: For conversions that involve a year, consider that a year is 365.25 days.
To convert from hours : minutes : seconds format, use the INT function.
To convert from decimal to hours : minutes : seconds format, use the divisor operator (/) together with the TEXT function.
Note: You can also apply the time format without using the TEXT function to specify the format. To view the number as a time: select the cell and, on the Home tab—in the Number group—click the arrow next to the Number Format box. Then click More Number Formats, click Custom in the Category list, and then click a custom format in the Type box. Keep in mind: if you use both a format applied with the TEXT function and number format, the TEXT function takes precedence.
Need more help?
You can always ask an expert in the Excel Tech Community or get support in the Answers community.
Need more help?
Want more options?
Explore subscription benefits, browse training courses, learn how to secure your device, and more.
Communities help you ask and answer questions, give feedback, and hear from experts with rich knowledge.
How to Use Excel > Excel Formula > How to Convert Time to Hours, Minutes and Seconds in Excel
How to Convert Time to Hours, Minutes and Seconds in Excel
Table of contents :
- Convert Time to Hours in Excel
- Formula #1, using multiplication formula
- Formula #2, using CONVERT function
- Formula #3, using HOUR, MINUTE and SECOND function
- Convert Time to Minutes in Excel
- Formula #1, using multiplication formula
- Formula #2, using CONVERT function
- Formula #3, using HOUR, MINUTE and SECOND function
- Convert Time to Seconds in Excel
- Formula #1, using multiplication formula
- Formula #2, using CONVERT function
- Formula #3, using HOUR, MINUTE and SECOND function
- Which One is the Best Solution?
Excel stores TIME values in decimal numbers, but in day unit. The first way to convert a time value to hours, minutes or seconds number is to use the multiplication formula.
The second way is using the excel CONVERT function, an excel function to convert from and to various units of measurement.
The third way to use the excel HOUR function, excel MINUTE function and excel SECOND function, but still involves mathematical formulas (multiplication or division).
For example, there is a TIME value in column A as shown below. How the conversion results to hours, minutes and seconds.
Convert Time to Hours in Excel
Formula #1, using multiplication formula
How to convert time to hours in excel? One day is 24 hours, to get the hour number from a TIME value is to multiply it by the number 24.
The Formula
=A3*24
The Result
Formula #2, using CONVERT function
Fill the number argument with cell A3
Fill the from_unit argument with “day”
Fill the to_unit argument with “hr”
The Formula
=CONVERT(A3,"day","hr")
The Result
The results are the same as the first way.
Formula #3, using HOUR, MINUTE and SECOND function
To get the HOUR number from the time value, why not just use the HOUR function? Why do the MINUTE function and SECOND function also apply?
The TIME value consists of hour, minute and second value. To get the hour value from the minute value divided by 60 (number of minutes in one hour) and to get an hour value from the second value divided by 3600 (number of seconds in one hour).
The Formula
=HOUR(A3)+(MINUTE(A3)/60)+(SECOND(A3)/3600)
The Result
The results remain the same as the previous two ways.
Convert Time to Minutes in Excel
Formula #1, using multiplication formula
How to convert time to minutes in excel? There are 1,440 minutes in a day, to get the minute number from a TIME value is to multiply it by the number 1440.
The Formula
=A3*1440
The Result
Formula #2, using CONVERT function
Fill the number argument with cell A3
Fill the from_unit argument with “day”
Fill the to_unit argument with “mn”
The Formula
=CONVERT(A3,"day","mn")
The Result
Formula #3, using HOUR, MINUTE and SECOND function
To get the minute number from the hour value multiplied by 60 (number of minutes in one hour) and to get the minute number from the second value divided by 60 (number of seconds in one minute).
The Formula
=(HOUR(A3)*60)+MINUTE(A3)+(SECOND(A3)/60)
The Result
Convert Time to Seconds in Excel
Formula #1, using multiplication formula
How to convert time to seconds in excel? to get the second number from a TIME value is to multiply it by the number 86400 (number of seconds in one day, 24 hours x 60 minutes x 60 seconds).
The Formula
=A3*86400
The Result
Formula #2, using CONVERT function
Fill the number argument with cell A3
Fill the from_unit argument with “day”
Fill the to_unit argument with “sec”
The Formula
=CONVERT(A3,"day","sec")
The Result
Formula #3, using HOUR, MINUTE and SECOND function
To get the second number from the hour value multiplied by 3600 (number of seconds in one hour) and to get the second number from the minute value multiplied by 60 (number of seconds in one minute).
The Formula
=(HOUR(A3)*3600)+(MINUTE(A3)*60)+SECOND(A3)
The Result
Which One the Best Solution?
All depends on you, which solution is the most convenient for you. For me formula #1, the multiplication formula is the simplest. Formula #2 uses one excel function, and the most complex is formula #3 using three excel functions plus multiplication and division formulas.
The choice is yours.
Related Function
Function used in this article
Related Articles
Another articles related to this article
Skip to content
В статье рассмотрены различные способы преобразования времени в десятичное число в Excel. Вы найдете множество формул для преобразования времени в часы, минуты или секунды.
Поскольку Microsoft Excel использует числовую систему для работы с временем, вы можете легко преобразовать часы, минуты и секунды в числа, и использовать их в других вычислениях.
Вот о чем мы поговорим в этой статье:
В общем, есть два способа преобразовать время в десятичное число в Excel —
- путем изменения формата ячейки
- с помощью арифметических вычислений и использованием функций Excel.
Далее вы найдете подробное объяснение первого способа и примеры формул, демонстрирующие второй метод.
Каки перевести время в десятичное число без формул
Как мы уже не раз говорили, дата и время в Excel представляют собой обычные числа, где отсчет начинается с 1 января 1900 года. Быстрый способ показать число, представляющее определенное время, — использовать диалоговое окно «Формат ячеек».
Для этого выберите ячейку, содержащую время, и нажмите Ctrl + 1
, чтобы открыть окно формата.На вкладке «Число» в разделе «Числовые форматы» выберите «Общий», и вы увидите длинную десятичную дробь в поле «Образец».
Такой перевод времени в число вы видите на скриншоте ниже.
Теперь вы можете записать это число и нажать кнопку «Отмена», чтобы закрыть окно и ничего не менять. Или же вы можете нажать кнопку OK и представить время в ячейке соответствующим ему десятичным числом.
Фактически, вы можете считать это самым быстрым, простым и без применения формул способе перевестивремя в десятичное число в Excel.
Как преобразовать время в десятичное число в Excel
Рассмотрим еще три способа преобразования значения времени в десятичное число:
- арифметическая операция,
- функция ПРЕОБР,
- комбинация трех различных функций времени.
Самый простой способ превратить время в десятичное число в Excel — умножить исходное значение времени на количество часов, секунд или минут в сутках:
- Чтобы преобразовать время в количество часов, умножьте время на 24, что соответствует количеству часов в сутках.
- Чтобы перевести время в число минут, умножьте на 1440, то есть на количество минут в сутках (24*60).
- Чтобы получить время в количестве секунд, умножьте его на 86400, что равно количеству секунд в сутках (24*60*60).
Далее мы рассмотрим другие методы превращения времени в десятичное число в Excel.
Как перевести время в число часов
В этом разделе демонстрируются три различных формулы для преобразования часов из стандартного формата времени (чч:мм:сс) в десятичное число.
Арифметические действия
Вы уже знаете самый быстрый способ преобразования значения времени в количество часов в Excel — умножение на 24, то есть на количество часов в одних сутках:
=A3*24 (где A2 — значение времени)
Чтобы получить полное количество часов, вставьте приведенную выше формулу в функцию ЦЕЛОЕ (INT в английской версии), или ОТБР (TRUNC по-английски). Обе они помогут избавиться от дробной части:
=ЦЕЛОЕ(A3*24)
=ОТБР(A3*24;0)
Разница между этими двумя функциями заключается в том, что ОТБР отбрасывает дробную часть, а функция ЦЕЛОЕ округляет число в меньшую сторону до ближайшего целого в зависимости от значения дробной части.
Эти функции различаются при использовании отрицательных чисел: ОТБР(-5,97;0) возвращает значение -5, просто отбрасывая все то, что находится после запятой. А вот выражение ЦЕЛОЕ(-5,97) возвращает -6, поскольку это ближайшее меньшее целое число. Но поскольку дата и время не могут быть отрицательными, то в данном случае для нас эти функции равноценны. Но лично я предпочитаю использовать ЦЕЛОЕ, поскольку не нужно дополнительно вводить никаких аргументов.
Функция ПРЕОБР
Другой способ выполнить преобразование «время > часы» — использовать следующую формулу преобразования:
ПРЕОБР(число; из_единиц; в_единицы),
или в нашем случае:
=ПРЕОБР(A3; «day»; «hr»)
Обратите внимание, что все единицы измерения здесь вводятся по-английски. Однако, для слабо владеющих английским это не будет проблемой, так как при вводе формулы нужные наименования вы сможете выбрать из выпадающего списка, в котором все пояснения будут по-русски.
Функции ЧАС, МИНУТЫ и СЕКУНДЫ
Наконец, можно использовать несколько более сложную формулу, логика которой, впрочем, вполне очевидна. Извлеките отдельные единицы времени с помощью функций ЧАС, МИНУТЫ и СЕКУНДЫ, затем разделите минуты на 60 (количество минут в часе) и секунды на 3600 (количество секунд в часе) и после этого сложите результаты:
=ЧАС(A3) + МИНУТЫ(A3)/60 + СЕКУНДЫ(A3)/3600
Как перевести время в число минут
Те же три способа можно использовать для преобразования минут из стандартного формата времени в десятичное число.
Арифметический расчет
Чтобы преобразовать время в общее количество минут, вы умножаете время на 1440, что является количеством минут в одном дне (24 часа * 60 минут = 1440):
=A3*1440
Если вы хотите вернуть точное число минут, используйте функцию ЦЕЛОЕ:
=ЦЕЛОЕ(A3*1440)
Вы можете просмотреть результаты на скриншоте ниже:
Функция ПРЕОБР
Чтобы выполнить преобразование «время > минуты» с помощью функции ПРЕОБР, укажите «day» и «mn» (день и минуты) в качестве единиц для преобразования:
=ПРЕОБР(A3; «day»; «mn»)
Функции ЧАС, МИНУТЫ и СЕКУНДЫ
Еще один способ получить количество минут — умножить часы на 60 и разделить секунды тоже на 60:
=ЧАС(A3)*60 + МИНУТЫ(A3) + СЕКУНДЫ(A3)/60
Как конвертировать время в число секунд
Превращение времени в общее количество секунд в Excel можно выполнить аналогичным образом.
Арифметический расчет
Умножьте значение времени на 86400, что равно количеству секунд в сутках (24 часа * 60 минут * 60 секунд = 86400):
=A3*86400
Функция ПРЕОБР
Формула в основном такая же, как и в приведенных выше примерах, с той лишь разницей, что вы конвертируете дни в секунды:
=ПРЕОБР(A3; «day»; «sec»)
Функции ЧАС, МИНУТЫ и СЕКУНДЫ
Я полагаю, что на данный момент вам не нужны дальнейшие объяснения логики этой формулы
=ЧАС(A3)*3600 + МИНУТЫ(A3)*60 + СЕКУНДЫ(A3)
Советы:
- Если какая-либо из приведенных выше формул возвращает значение, отформатированное как время, просто измените формат ячейки на Общий или Числовой, чтобы отобразить результат в виде десятичного числа.
- Чтобы преобразовать время в десятичное число, представляющее время во внутренней системе Excel , примените к ячейке общий формат. При таком подходе 23:59:59 будет преобразовано в 0,99999, 06:00 — в 0,25, а 12:00 — в 0,5. Если целая часть отформатированного числа больше нуля, это означает, что ваша ячейка содержит значения не только времени, но еще и дату.
Надеюсь, теперь преобразование времени в число не будет для вас проблемой.
By default, date and time are saved as numbers/decimals in Excel. But you often see it in different formats because of the way the cells have been formatted.
For example, in the below example, the value in column A and B is the same, but these are displayed differently because of the format.
And one of the things many people need in Excel is to convert the time to decimal (such as hours or minutes or seconds).
For example, instead of having the date and time as 01-01-2020 6:30 AM, you may want the get:
- Number of hours as 6
- Number of minutes as 30
Thankfully Excel has some awesome formulas, you can easily convert time to decimal values.
How to Convert Time to Decimal Numbers in Excel
In this tutorial, I will show you some examples of converting time to a decimal using formulas (i.e, converting time to hours, minutes, and seconds).
There are multiple ways to convert time to decimal in Excel:
- Using arithmetic operation is the easiest way to convert time to decimal numbers. For example:
- To convert time to hours, multiply the time value with 24
- To convert time to minutes, multiply the time value with 24*60
- To convert time to seconds, multiply the time value with 24*60*60
- You can also use Excel in-built formulas such as CONVERT or HOUR/MINUTE/SECOND
In the sections that follow, I will show you examples of how to convert Excel time to decimal values using these methods.
So let’s get started!
Convert Time to Hours in Excel
In this section, I cover three different ways to convert time to hours in Excel.
Using Simple Multiplication to Get the Hour Value
Suppose you have the time in a cell as 6:00 PM (in cell A2) and you want to convert it into hours.
You can simply multiply it by 24 and it will give you how many hours have elapsed till that time.
=A2*24
This works because of the fact that Excel stores dates and times as numbers. A full day (24 hours) is stored as 1 in Excel. This means that each hour is stored as 1/24.
So while you see the value 6:00 PM, in the backend, it is stored as the value 0.75 (indicating that 18 hours out of the 24 hours have already passed). So, when you multiply it with 24, it gives you the number of hours that have passed.
In case you have a value such as 6:32 PM, using the above formula will give you the result as 18.53 (where the minutes/seconds part is shown in decimals and full/complete hours as integers). In this example, the numeric value of 32 minutes in Excel would be 0.53 hours.
Note: In case you get the hour value that has the decimals (such as 18.53), make you sure you have formatted it to show the decimals as well. In case you haven’t, you may see the result as 19, as Excel shows you the rounded off integer value. However, this wouldn’t change the value in the cell, which will continue to be 18.53
In case you only want the complete/full hour value and ignore the minutes part, use the below formula using INT.
=INT(A2*24)
INT only gives you the integer part and you don’t have to worry about any extra minutes.
Using Excel Functions (HOUR, MINUTE, and SECOND)
If you don’t like the manual multiplication method, another really easy way to convert time to hours is by using the inbuilt time-related functions (HOUR, MINUTE, and SECOND)
Suppose, you have the times as shown below and you want to know how many hours have elapsed in the day.
Below is the formula to convert the time into hours
=HOUR(A2)+MINUTE(A2)/60+SECOND(A2)/(60*60)
The HOUR function simply returns the number of hours that have elapsed in the given time, and so does the MINUTE and SECOND function.
But since we need the final value in hours, we need to divide the minute value by 60 (to convert it into hours) and the second value by 60*60 (again to convert it into hours).
Using the Convert Function
Another really easy (probably the easiest of the three methods), is to use the CONVERT function.
This function takes a numerical value (which would be the time in this case) and can convert it into hours (or minutes/seconds).
Below is the formula that will convert time into hours:
=CONVERT(A2,"day","hr")
The second argument is to tell the function of the existing data format and the third argument is the format to which you want to convert.
Note: Sometimes the results may look different than expected. This could be due to the cell format which may show the result in a date format instead of decimal format. You can easily change this by going to the Home tab and setting the format from the format drop-down (it’s in the Number group)
In practice, you’re more likely to get date and time together (instead of just the time as I have shown in the examples above). You can still use the methods shown above, but you first need to split the date and time value and then use the methods shown above on only the time part. Later in this tutorial, I also cover two methods to separate date and time in Excel using formulas.
You can also use these same methods covered above to convert time to minutes and seconds.
Let’s quickly have a look at those examples as well.
Convert Time to Minutes in Excel
In this section, I cover three different ways to convert time to minutes in Excel.
Using Simple Multiplication to Get the Minute Value
In a day, there are 1440 minutes (24*60).
So, to convert time to minutes, you can simply multiply the time value with 1440.
Suppose you have the time in a cell as 6:00 PM (in cell A2) and you want to convert it into minutes.
Below is the formula to do this:
=A2*1440
This will give you the total number of minutes that have elapsed on that day in the given time.
Note: Remember that in case you have seconds as well in the time, these will be converted into minutes and be shown as the decimal part. For these to be visible in the result, you need to format the resulting cells to show results up to 2/3 decimal places.
In case you only want the minute value and ignore the seconds part, use the below formula using INT.
=INT(A2*1440)
Using Excel Functions (HOUR, MINUTE, and SECOND)
Just like we used these functions to get the hour value, you can also use these to convert time to minutes.
Below is the formula that will convert time to minutes using these functions:
=HOUR(A2)*60+MINUTE(A2)+SECOND(A2)/60
Since the aim here to get all the parts in minutes (hours, minutes, and seconds), we multiply 60 with hours to get the minutes value in it and we divide seconds by 60 to get the minute value.
Using the Convert Function
Again, definitely the easiest way to convert time to minutes is by using the convert formula.
The below formula takes the time value and converts it into minutes;
=CONVERT(A2,"day","mn")
The second argument tells the function that the value in cell A2 is in day format and the third argument (“mn”) tells it to convert it into minutes.
Convert Time to Seconds in Excel
In this section, I cover three different ways to convert time to seconds in Excel.
Using Simple Multiplication to Get the Seconds Value
In a day, there are 86400 seconds (24*60*60).
So, to convert time to seconds, you can simply multiply the time value with 86400.
Suppose you have the time in a cell as 6:32:30 PM (in cell A2) and you want to convert it into seconds.
Below is the formula to do this:
=A2*86400
This will give you the total number of seconds that have elapsed on that day in the given time.
Using Excel Functions (HOUR, MINUTE, and SECOND)
Below is the formula that will convert time to minutes using these functions:
=HOUR(A2)*60*60+MINUTE(A2)*60+SECOND(A2)
Since the aim here to get all the parts (hours, minutes, and seconds) in seconds, we multiply 60*60 with hours to get the seconds value in it and we multiply minutes by 60 to get the seconds value.
Split Date and Time and Then Convert Time to Decimal
So far, we have seen examples where we only have the time and we wanted to convert that time into hours, minutes or seconds.
But what if you have the date as well as the time?
In that case, you can not use the above methods directly. You will first have to split the date and time and then convert the time to decimals.
Since date and time are stored as numbers in Excel, separating these gets easier.
A full day is stored as an integer and the time part is stored as a decimal value. So if you want to separate date and time, you simply need to separate the integer part and the decimal part.
Let’s have a look at a couple of really easy ways to split the date and time in Excel.
Split Date and Time using INT Formula
Suppose you have the dataset as shown below and you want to split the date and time.
To do this, enter the following formula in cell B2:
=A2-INT(A2)
The above formula removes the integer part and gives you the decimal part of the date.
Now you can use any of the three methods covered above (using arithmetic multiplication, using HOUR/MINUTE/SECOND formula, or using the CONVERT formula) to convert the time to decimal.
Also read: How to Convert Seconds to Minutes in Excel (Easy Formula)
Split Date and Time using the MOD Formula
Another way to do this can be by using the MOD function.
Suppose you have the dataset as shown below and you want to split the date and time.
To do this, enter the following formula in cell B2:
=MOD(A2,1)
This would give you the decimal part right away and then you can use any of the three methods covered above to convert time to decimal numbers (hours, minutes, or seconds).
You may also like the following Excel tutorials:
- Calculate Time in Excel (Time Difference, Hours Worked, Add/ Subtract)
- How to Remove Time from Date/Timestamp in Excel
- How to Insert Date and Timestamp in Excel
- How to Calculate the Number of Days Between Two Dates in Excel
- Convert Date to Text in Excel
- How to Stop Excel from Changing Numbers to Dates
- How to Stop Excel from Rounding Numbers (Decimals/Fractions)
- How to Display Numbers as Fractions in Excel (Write Fractions in Excel)