简体   繁体   中英

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. What I want to achieve is setting the first "date-time" as "0s" and set the succeeding "date-time" with reference to "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. 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. 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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM