From unix time excel

Временная метка Unix также называется временем эпохи или временем POSIX, которое широко используется во многих операционных системах или форматах файлов. В этом руководстве рассказывается о преобразовании между датой и меткой времени Unix в Excel.

Преобразовать дату в метку времени

Преобразование даты и времени в метку времени

Преобразовать метку времени на дату

Дополнительные руководства по преобразованию даты и времени …


стрелка синий правый пузырь Преобразовать дату в метку времени

Чтобы преобразовать дату в метку времени, формула может вычислить это.

Выберите пустую ячейку, предположим, ячейку C2, и введите эту формулу = (C2-ДАТА (1970,1,1)) * 86400 в это и нажмите Enter key, при необходимости вы можете применить диапазон с этой формулой, перетащив маркер автозаполнения. Теперь диапазон ячеек даты преобразован в метки времени Unix.
документ-конвертировать-дата-unix-1


время конвертации документов 1


стрелка синий правый пузырь Преобразование даты и времени в метку времени

Существует формула, которая может помочь вам преобразовать дату и время в метку времени Unix.

1. Во-первых, вам нужно ввести всемирное координированное время в ячейку, 1. Смотрите скриншот:
документ-конвертировать-дата-unix-2

2. Затем введите эту формулу = (A1- $ C $ 1) * 86400 в ячейку, нажмите Enter , а затем при необходимости перетащите дескриптор автозаполнения в диапазон с этой формулой. Смотрите скриншот:
документ-конвертировать-дата-unix-3

Tips: В формуле A1 — это ячейка даты и времени, C1 — введенная вами координата всемирного времени.


стрелка синий правый пузырь Преобразовать метку времени на дату

Если у вас есть список временных меток, необходимых для преобразования на сегодняшний день, вы можете сделать следующие шаги:

1. В пустой ячейке рядом со списком временных меток введите эту формулу. =(((A1/60)/60)/24)+DATE(1970,1,1), нажмите Enter и перетащите маркер автозаполнения в нужный диапазон.
документ-конвертировать-дата-unix-4

2. Затем щелкните правой кнопкой мыши ячейки, в которых используется формула, и выберите Формат ячеек из контекстного меню, затем во всплывающем Формат ячеек диалог под Nвокруг вкладку нажмите Время в Категория список, затем выберите тип даты в правом разделе.
документ-конвертировать-дата-unix-5

3. Нажмите OK, теперь вы можете видеть, что метки времени Unix преобразованы в даты.
документ-конвертировать-дата-unix-6

Ноты:

1. A1 указывает нужную ячейку с отметкой времени.

2. Эту формулу также можно использовать для преобразования ряда временных меток в дату и время, просто отформатируйте результат в формате даты и времени.

3. Приведенная выше формула преобразует 10-значное число в стандартную дату и время. Если вы хотите преобразовать 11-значное число, 13-значное число или 16-значное число в стандартную дату и время в Excel, используйте формулу, как показано ниже:

Преобразование 11-значного числа в дату: =A1/864000+ДАТА(1970,1,1)

Преобразование 13-значного числа в дату: =A1/86400000+ДАТА(1970,1,1)

Преобразование 16-значного числа в дату: =A1/86400000000+ДАТА(1970,1,1)

Для разной длины числа, которое необходимо преобразовать в дату и время, просто измените количество нулей делителя в формуле, чтобы правильно получить результат.


Относительные статьи:

  • Как преобразовать дату и время из одного часового пояса в другой в Excel?
    Эта статья покажет вам, как преобразовать дату и время из одного часового пояса в другой в Excel.

  • Как разделить дату и время из ячейки на две отдельные ячейки в Excel?
    Например, у вас есть список данных, смешанных с датой и временем, и вы хотите разделить каждую из них на две ячейки, одна — это дата, а другая — время, как показано ниже. В этой статье представлены два быстрых метода решения этой проблемы в Excel.

  • Как преобразовать ячейку формата даты / времени в дату только в Excel?
    Если вы хотите преобразовать ячейку формата даты и времени только в значение даты, такое как 2016/4/7 1:01 AM до 2016/4/7, эта статья может вам помочь.

  • Как убрать время с даты в Excel?
    Если есть столбец даты с отметкой времени, например, 2 17:2012, и вы не хотите сохранять отметку времени и хотите удалить время 12:23 из даты и оставить только дату 12. Как можно быстро удалить время из даты в нескольких ячейках Excel?

  • Как объединить дату и время в одну ячейку в Excel?
    На листе есть два столбца, один — это дата, другой — время. Есть ли способ быстро объединить эти два столбца в один и сохранить формат времени? Теперь в этой статье представлены два способа в Excel объединить столбец даты и столбца времени в один и сохранить формат времени.


Лучшие инструменты для работы в офисе

Kutools for Excel Решит большинство ваших проблем и повысит вашу производительность на 80%

  • Снова использовать: Быстро вставить сложные формулы, диаграммы и все, что вы использовали раньше; Зашифровать ячейки с паролем; Создать список рассылки и отправлять электронные письма …
  • Бар Супер Формулы (легко редактировать несколько строк текста и формул); Макет для чтения (легко читать и редактировать большое количество ячеек); Вставить в отфильтрованный диапазон
  • Объединить ячейки / строки / столбцы без потери данных; Разделить содержимое ячеек; Объединить повторяющиеся строки / столбцы… Предотвращение дублирования ячеек; Сравнить диапазоны
  • Выберите Дубликат или Уникальный Ряды; Выбрать пустые строки (все ячейки пустые); Супер находка и нечеткая находка во многих рабочих тетрадях; Случайный выбор …
  • Точная копия Несколько ячеек без изменения ссылки на формулу; Автоматическое создание ссылок на несколько листов; Вставить пули, Флажки и многое другое …
  • Извлечь текст, Добавить текст, Удалить по позиции, Удалить пробел; Создание и печать промежуточных итогов по страницам; Преобразование содержимого ячеек в комментарии
  • Суперфильтр (сохранять и применять схемы фильтров к другим листам); Расширенная сортировка по месяцам / неделям / дням, периодичности и др .; Специальный фильтр жирным, курсивом …
  • Комбинируйте книги и рабочие листы; Объединить таблицы на основе ключевых столбцов; Разделить данные на несколько листов; Пакетное преобразование xls, xlsx и PDF
  • Более 300 мощных функций. Поддерживает Office/Excel 2007-2021 и 365. Поддерживает все языки. Простое развертывание на вашем предприятии или в организации. Полнофункциональная 30-дневная бесплатная пробная версия. 60-дневная гарантия возврата денег.

вкладка kte 201905


Вкладка Office: интерфейс с вкладками в Office и упрощение работы

  • Включение редактирования и чтения с вкладками в Word, Excel, PowerPoint, Издатель, доступ, Visio и проект.
  • Открывайте и создавайте несколько документов на новых вкладках одного окна, а не в новых окнах.
  • Повышает вашу продуктивность на 50% и сокращает количество щелчков мышью на сотни каждый день!

офисный дно

Summary

To convert a Unix timestamp to Excel’s date format, you can use a formula based on the DATE function. In the example shown, the formula in C5 is:

=(B5/86400)+DATE(1970,1,1)

Generic formula

Explanation 

The Unix time stamp tracks time as a running count of seconds. The count begins at the «Unix Epoch» on January 1st, 1970, so a Unix time stamp is simply the total seconds between any given date and the Unix Epoch. Since a day contains 86400 seconds (24 hours x 60 minutes x 60 seconds), conversion to Excel time can be done by dividing days by 86400 and adding the date value for January 1st, 1970.

In the example shown, the formula first divides the time stamp value in B5 by 86400, then adds the date value for the Unix Epoch, January 1, 1970. The formula evaluates like this:

=(B5/86400)+DATE(1970,1,1)
=(1538352000/86400)+25569
=43374

When C5 is formatted with the Excel date «d-mmm-yyyy», the date is displayed as 1-Oct-2018.

How Excel tracks dates time

The Excel date system starts on January 1, 1900 and counts forward. The table below shows the numeric values associated with a few random dates:

Date Raw value
1-Jan-1900 1
28-Jul-1914 00:00 5323
1-Jan-1970 00:00 25569
31-Dec-1999 36525
1-Oct-2018 43374
1-Oct-2018 12:00 PM 43374.5

Notice the last date includes a time as well. Since one day equals 1, and one day equals 24 hours, time in Excel can represented as fractional values of 1, as shown in the table below. In order to see the value displayed as a time, a time format needs to be applied.

Hours Time Fraction Value
3 3:00 AM 3/24 0.125
6 6:00 AM 6/24 0.25
4 4:00 AM 4/24 0.167
8 8:00 AM 8/24 0.333
12 12:00 PM 12/24 0.5
18 6:00 PM 18/24 0.75
21 9:00 PM 21/24 0.875
24 12:00 AM 24/24 1

Dave Bruns Profile Picture

AuthorMicrosoft Most Valuable Professional Award

Dave Bruns

Hi — I’m Dave Bruns, and I run Exceljet with my wife, Lisa. Our goal is to help you work faster in Excel. We create short videos, and clear examples of formulas, functions, pivot tables, conditional formatting, and charts.

There are hundreds and hundreds of Excel sites out there. I’ve been to many and most are an exercise in frustration. Found yours today and wanted to let you know that it might be the simplest and easiest site that will get me where I want to go.

Get Training

Quick, clean, and to the point training

Learn Excel with high quality video training. Our videos are quick, clean, and to the point, so you can learn Excel in less time, and easily review key topics when needed. Each video comes with its own practice worksheet.

View Paid Training & Bundles

Help us improve Exceljet

Содержание

  • Что такое Unix Time
  • Преобразование времени Excel в время Unix
  • Преобразование времени Unix в время Excel
  • Преобразование времени Excel в время Unix в Google Таблицах

Скачать пример рабочей книги

Загрузите образец книги

В этом руководстве будет показано, как преобразовать время в формате Excel в время Unix в Excel и Google Таблицах.

Что такое Unix Time

Время Unix также известно как время эпохи, время POSIX или временная метка Unix. Это система, которая считает количество секунд, прошедших с эпохи Unix, т. Е. 1 января.ул, 1970. Проще говоря, время Unix — это общее количество секунд между датой и эпохой Unix.

Чтобы рассчитать время Unix, сначала нам нужно найти общее количество дней между временем Excel и временем эпохи. Затем умножьте вычисленные дни на 86 400, потому что в сутках 86 400 секунд (24 часа × 60 минут × 60 секунд = 86 400 секунд).

1 = (B5-ДАТА (1970,1,1)) * 86400

Пошаговое объяснение

Первым шагом в преобразовании времени Excel в время Unix является вычисление числового значения даты эпохи. Это можно сделать с помощью функции ДАТА.

Это дает нам эту ценность:

=25569

Таким же образом вычисленное числовое значение даты эпохи вычитается из числового значения данного времени в Excel.

=(40422-25569)
=(14853)

После этого рассчитанная выше разница умножается на 86400, чтобы получить результирующее значение в секундах.

=(14853)*86400

Это общее количество секунд, которое мы получаем между двумя датами.

=1283299200

Преобразование времени Unix в время Excel

И наоборот, мы можем преобразовать время Unix в время Excel с помощью следующей формулы:

1 = (B3 / 86400) + ДАТА (1970,1,1)

Пошаговое объяснение
Сначала временная метка Unix делится на общее количество секунд в дне, то есть 86400.

=14853

Теперь мы вычисляем числовое значение даты эпохи с помощью функции ДАТА.

=25569

Получив числовое значение даты эпохи, мы добавим эти два значения.

= 14853 + 25569
= 40422

Результирующее значение, которое мы получили после расчета, находится в формате порядкового номера даты. Чтобы просмотреть его в формате даты, просто измените формат ячейки на Дата или требуемый настраиваемый формат из числового формата, открыв его через вкладку «Главная».

или нажав CTRL + 1

После изменения формата числовых значений даты и времени Excel мы получаем следующие дату и время Excel

Преобразование времени Excel в время Unix в Google Таблицах

Формула преобразования времени в Unix-время в Google Таблицах работает точно так же, как и в Excel.

Вы поможете развитию сайта, поделившись страницей с друзьями

Unix Timestamp conversions in Excel and in Power query are becoming more and more common.  With the ability to connect to a vast variety of data sources, the likelihood of you coming across a Unix timestamp is increasing.   The first time I came across a UNIX-based time was when I was connecting to a database from Excel and although the field was named Time, I had no idea what all these numbers meant, and I was left totally confused.

Unix time is commonly used in operating systems and programs that timestamp transactions as they happen.  The reason Unix time is used is that no matter where you live or the time zone you are in, this Unix timestamp represents a moment that is the same everywhere.

So, what is Unix time?  Unix time is the duration in seconds or milliseconds from midnight of the 1st January 1970 in UCT time.  It is represented by a 32-bit integer that can be positive or negative.  There is however a limitation of Unix time.  Unfortunately, there are upper and lower bounds which restricts the actual time span available.  Unix time spans from December 13th, 1901, and will end on the 19th of January 2038.  This is known as the Y38 Problem.

So now that you have a basic knowledge of Unix time, how can we work with this in Excel or Power Query?  Throughout the rest of this article, you are going to learn how to carry out Unix Timestamp conversions in Excel.  We will convert back and forth from Unix time to Excel time in both Excel and Power Query. 

How to convert Unix time to Excel Time

Let us first explore converting Unix time to Excel Time.  First, we will look at the formula when the timestamp is in second and then we will look at the formula when the timestamp is in milliseconds.

When time stamp in Seconds

The formula used to convert Unix timestamp recorded in seconds is:

= (Unix time/86400) +DATE (1970,1,1)

Remember to replace Unix Time with the cell reference that contains the Unix timestamp.

Once you enter this formula into the cell, the formula can be dragged down and copied to other cells in the workbook.

Unix Timestamp conversions in Excel

When the timestamp is in Milliseconds

The formula used to convert Unix timestamp recorded in milliseconds is:

= ((Unix time/1000)/86400) +DATE (1970,1,1)

Remember to replace Unix Time with the cell reference that contains the Unix timestamp.

Unix Timestamp conversions in Excel

How to convert Excel time to Unix time

With a reversal of the formula, we used to convert Unix time to Excel time, we can covert Excel time to Unix time.

The formula to convert Excel time to Unix time in seconds is.

= ((Excel Time – DATE(1970,1,1)) *86400

Remember to replace Excel Time in the formula with the cell reference that contains the time you wish to convert to Unix time.

Unix Timestamp conversions in Excel

The formula to convert Excel time to Unix time in milliseconds is.

= ((Excel Time -DATE (1970,1,1)) *1000) *86400

Unix Timestamp conversions in Excel

How to convert Unix time in Power query

Power query is used in both Excel and Power BI to connect to and transform data into a useable format.  The more you connect to different data sources the more often you will come across date columns in Unix format.  Once you have the data in Power query, a calculated column can be added to the data to carry out the conversions necessary.

How to convert from Unix time in Power Query for Excel and Power BI

From the Add Column tab on the ribbons in Power Query, select Custom Column.  This will allow us to set up a new column in our data based on a calculation or formula.

Unix Timestamp conversions in Excel

When we select Custom Column, a new box will open to allow us to enter a formula.  We can give our new column a name and enter the formula into the space provided.  Remember to replace [Unix time] with the column in Power query that contains the Unix time.

The formula we need to enter when converting from a timestamp recorded in seconds is as follows.

=#datetime(1970,1,1,0,0,0) + duration(0,0,0,[Unix time])

The formula we need to enter when converting from a timestamp recorded in milliseconds is as follows.

=#datetime(1970,1,1,0,0,0) + duration(0,0,0,[Unix time]/1000)

Unix Timestamp conversions in Excel

Once we confirm our formula by pressing OK, a new column will appear in Power query showing the date and time.

Unix Timestamp conversions in Excel

The last step is to ensure you set this new column to the correct data type.  This can be done from the Transform tab in the Power Query Ribbons. 

Unix Timestamp conversions in Excel

Depending on your need, you can select between

  • Date/Time
  • Date
  • Time
  • Date/Time/Time zone
  • Duration

In the example shown, we have selected the data type of Date.

Unix Timestamp conversions in Excel

How to convert to Unix time in Power Query for Excel and Power BI

Using Power Query in both Excel and Power BI it is easy to convert an Excel or Power BI date and time to a Unix timestamp using a custom column as we did above.

Once we have the date-time column in Power query, Select custom column.

Unix Timestamp conversions in Excel

The function we use to convert to Unix time is:

Duration.TotalSeconds([Excel date/time column]-#datetime(1970,1,1,0,0,0) )

(remember to replace [Excel date/time column] with the column that contains the date/time that you wish to convert to Unix.)

Unix Timestamp conversions in Excel

Conclusion

The more we work with different data sources in Excel Working with Unix Time in Excel and In Power Query for Excel and Power BI will become more and more common.  For this reason, we need to have the ability to convert Unix time to Excel time and Excel time to Unix time.  In this article, we looked at using both formulas and Power Query to carry out Unix Timestamp conversions in Excel.  If you are working with large sets of data, I would recommend the Power query option, but then if you are working with a large set of data that contains Unix timestamps, most likely you have used Power Query to connect to it in the first place.

TLDR

=(A1/86400)+25569

…and the format of the cell should be date.

If it doesn’t work for you

  • If you get a number you forgot to format the output cell as a date.
  • If you get ##### you probably don’t have a real Unix time. Check your
    timestamps in https://www.epochconverter.com/. Try to divide your input by 10, 100, 1000 or 10000**
  • You work with timestamps outside Excel’s (very extended) limits.
  • You didn’t replace A1 with the cell containing the timestamp ;-p

Explanation

Unix system represent a point in time as a number. Specifically the number of seconds* since a zero-time called the Unix epoch which is 1/1/1970 00:00 UTC/GMT. This number of seconds is called «Unix timestamp» or «Unix time» or «POSIX time» or just «timestamp» and sometimes (confusingly) «Unix epoch».

In the case of Excel they chose a different zero-time and step (because who wouldn’t like variety in technical details?). So Excel counts days since 24 hours before 1/1/1900 UTC/GMT. So 25569 corresponds to 1/1/1970 00:00 UTC/GMT and 25570 to 2/1/1970 00:00.

Now if you also note that we have 86400 seconds per day (24 hours x60 minutes x60 seconds) and you will understand what this formula does: A1/86400 converts seconds to days and +25569 adjusts for the offset between what is zero-time for Unix and what is zero-time for Excel.

By the way DATE(1970,1,1) will helpfully return 25569 for you in case you forget all this so a more «self-documenting» way to write our formula is:

=A1/(24*60*60) + DATE(1970,1,1)

P.S.: All these were already present in other answers and comments just not laid out as I like them and I don’t feel it’s OK to edit the hell out of another answer.


*: that’s almost correct because you should not count leap seconds

**: E.g. in the case of this question the number was milliseconds since the the Unix epoch.

Понравилась статья? Поделить с друзьями:
  • From this time for the never will speak word
  • From this point forward word
  • From the word itself
  • From the word go перевод идиомы
  • From the word go idiom