简体   繁体   English

在EXCEL中将日期时间(yyyy-mm-dd hh:mm:ss)格式转换为秒

[英]Converting Date-Time (yyyy-mm-dd hh:mm:ss) format to seconds in EXCEL

I have a long list of "date-time" data which are formatted as (yyyy-mm-dd hh:mm:ss) and sorted in chronological order. 我有一长串的“日期时间”数据,其格式为(yyyy-mm-dd hh:mm:ss)并按时间顺序排序。 What I want to achieve is setting the first "date-time" as "0s" and set the succeeding "date-time" with reference to "0s". 我要实现的是将第一个“日期时间”设置为“ 0s”,然后将后续的“日期时间”设置为参考“ 0s”。 For example, if the first date is 2015-01-01 00:00:00 and nth date is 2015-01-02 00:00:00, then since exactly 24 hours=86400 seconds passed, I want the "date-time" to be converted to "0" for the first datum and "86400" for the nth datum. 例如,如果第一个日期是2015年1月1日00:00:00,第n个日期是2015年1月2日00:00:00,那么由于正好经过24小时= 86400秒,我希望“日期时间将第一个数据转换为“ 0”,将第n个数据转换为“ 86400”。 I don't want them to be renewed when the day passes. 我不希望在一天过去时更新它们。 I tried to achieve this by simply subtracting the 1st datum form the nth datum, but I confronted the problem of seconds getting renewed when the day pass. 我试图通过简单地从第n个基准减去第一个基准来实现这一点,但是我遇到了一天过去时秒数更新的问题。 I need some concrete hint about solving this problem or if there is simple function for achieving this, please let me know. 我需要一些有关解决此问题的具体提示,或者如果有实现此目的的简单功能,请告诉我。

I think you could simply do: 我认为您可以做到:

=A2-A1

And custom format the cell: 并自定义格式化单元格:

[s]

在此处输入图片说明

我认为您可以简单地将此公式放入所需的单元格中:

=(A2-A1)*86400

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Excel 默认日期时间格式 yyyy-mm-dd hh:mm:ss 与 yyyy-mm-dd hh:mm - Excel default date time format yyyy-mm-dd hh:mm:ss versus yyyy-mm-dd hh:mm excel 中的列格式,yyyy-mm-dd hh:mm:ss - Column format in excel, yyyy-mm-dd hh:mm:ss Perl在Excel中将yyyy-mm-dd HH:mm:ss转换为yyyy-mm-dd - Perl Format yyyy-mm-dd HH:mm:ss to yyyy-mm-dd in Excel 在 Excel 中将 yyyy-MM-ddTHH:mm:ssZ 日期转换为 yyyy-MM-dd HH:MM:ss - Convert yyyy-MM-ddTHH:mm:ssZ date to yyyy-MM-dd HH:MM:ss in Excel 如何在MySQL中导入Excel存储的数据并保持日期格式为yyyy-mm-dd hh:mm:ss - How to import excel stored data in MySQL and keep date format as yyyy-mm-dd hh:mm:ss 将2/17/2013 10:37 AM转换为日期格式“ MM / DD / YYYY HH:MM:SS” excel - converting 2/17/2013 10:37 AM to date format “MM/DD/YYYY HH:MM:SS” excel Excel VBA:将日期格式从YYYY-MM-DD-HH.MM.SS.Milli转换为DD / MM / YYYY HH:MM:SS - Excel VBA : Convert date format from YYYY-MM-DD-HH.MM.SS.Milli to DD/MM/YYYY HH:MM:SS 在Excel中将MM:DD:YYYY hh:mm:ss转换为DD:MM:YYYY hh:mm:ss - Converting MM:DD:YYYY hh:mm:ss to DD:MM:YYYY hh:mm:ss in excel 如何计算两个单元格之间的时间差(以秒为单位),其中单元格格式为“yyyy-mm-dd hh:mm:ss”格式的文本? - How to calculate time difference in seconds between two cells, where cells are formatted as text in format “yyyy-mm-dd hh:mm:ss”? 将时间戳记('YYYY-MM-DD HH:MM:SS')转换为简单的日期时间格式 - Converting Timestamp('YYYY-MM-DD HH:MM:SS') to simple datetime format
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM