简体   繁体   English

Excel iso 8601时间戳减去2小时转换

[英]Excel iso 8601 timestamp subtract 2 hours convert

I have a large amount of date/time fields that need to be changed in excel. 我有大量的日期/时间字段,需要在excel中进行更改。 I need to subtract 2 hours from the current date/time format ISO 8601. 我需要从当前日期/时间格式ISO 8601中减去2小时。

Ex: 2006-09-21 16:45:00 +0000 <----Changed to------>2006-09-21 14:45:00 +0000 例如:2006-09-21 16:45:00 +0000 <----更改为------> 2006-09-21 14:45:00 +0000

I was able to parse the data into separate columns and subtract 2 hours using this formula: =B1+TIME(2,0,0) and then concentrate the columns back. 我能够将数据解析为单独的列,并使用以下公式减去2小时:= B1 + TIME(2,0,0),然后将列集中。

I ran into a problem when the time is 01:59:99 or less. 时间是01:59:99或更短时,我遇到了一个问题。 It gives me ####### 它给了我#######

Anyone have a formula to subtract 2 hours from ISO 8601 format. 任何人都有一个公式可以从ISO 8601格式中减去2个小时。 Please and thank you. 谢谢,麻烦您了。

This should help, if your original value is in Cell A2: 如果您的原始值位于单元格A2中,这应该会有所帮助:

=IF(NUMBERVALUE(MID(A2,12,2))<2,LEFT(A2,8)&TEXT(NUMBERVALUE(MID(A2,9,2))-1,"00")&" "&TEXT(NUMBERVALUE(MID(A2,12,2)-2+24),"00")&RIGHT(A2,12),LEFT(A2,8)&TEXT(NUMBERVALUE(MID(A2,9,2)),"00")&" "&TEXT(NUMBERVALUE(MID(A2,12,2)-2),"00")&RIGHT(A2,12))

Thanks, Tim 谢谢,蒂姆

If you want to do this in a single formula, you can use: 如果要在一个公式中执行此操作,则可以使用:

A1:  your_ISO_datetime
B1:  =LEFT(A1,19)-TIME(2,0,0)
   with custom format: yyyy-mm-dd hh:mm:ss "+0000"

在此输入图像描述

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

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