简体   繁体   English

将带连字符的持续时间转换为 UTC

[英]Convert hyphenated time duration to UTC

The format of the time I'm working on is this: 12/20/2022 2:00 - 4:00.我工作的时间格式是这样的:12/20/2022 2:00 - 4:00。 I'd like to convert this to UTC so -8, i'd hope it'll look like this: 12/19/2022 18:00 - 20:00.我想将其转换为 UTC,所以 -8,我希望它看起来像这样:12/19/2022 18:00 - 20:00。

The Google sheet formula =A1+(-8/24) doesn't seem to work since it doesn't recognize the hyphen as a number. Google 表格公式 =A1+(-8/24) 似乎不起作用,因为它无法将连字符识别为数字。 I've updated the Format to Number and Date, but get the same error.我已将格式更新为数字和日期,但出现相同的错误。 Is there any other formula or workaround I can try?我可以尝试其他公式或解决方法吗? Thank you.谢谢你。

The thing here is that they're not a number itself.这里的问题是它们本身不是数字。 Considering this is always the format you'll have, you can Try this formula:考虑到这始终是您将拥有的格式,您可以试试这个公式:

=TEXT(DATEVALUE(REGEXEXTRACT(A1,"^(.+) - "))-TIME(8,0,0),"MM/DD/YYYY HH:MM")&" - "&TEXT(TIMEVALUE(REGEXEXTRACT(A1,".* - (.*)"))-TIME(8,0,0),"hh:mm")

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

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