在Excel中设置带时区的日期的格式代码 [英] Format code for a date with time zone in excel

查看:579
本文介绍了在Excel中设置带时区的日期的格式代码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个带时区的日期值。


2005年11月24日GMT + 05:30


在Excel中此自定义格式的格式代码是什么?



我尝试了 dd MMM yyyy z zz zzz Z ,但Excel会忽略这些选项。

解决方案

不确定。我刚刚遍历了自定义格式单元格中的每个字母,但看起来不对。



我建议将其分成几个单元格,然后将它们全部合并



在第一列(A1)中,您可以输入日期,格式化自己喜欢的日期(dd mmm yyyy)。



第二个(B1),您可能需要一段时间才能说明不同的时区(格式化后的格式,即hh:mm:ss。



第三(C1)用加/减符号定义时区在前还是后。



第四(D1)您可以设置时差(例如,示例+5: 30)。将单元格设置为h:mm。



第五(E1),输入公式:= IF(C1 = +,B1 + D1,IF( C1 =-,B1-D1))。将单元格的格式设置为hh:mm:ss。



最后,(F1)有两个选项供您选择。

第一种方法是将调整为时区的日期和时间组合在一起,也可以组合日期,原始时间并包括时区。是:= TEXT(A1, dd mmm yyyy)& TEXT(E2, hh:mm:ss)



第二个是:= TEXT(A1 , dd mmm yyyy)& TEXT(B1, hh:mm:ss)& GMT& TEXT(C1,)& TEXT(D1, h:mm)



这是我能想到的绝对最佳解决方案。抱歉,不是您要的。


I have date value with a time zone.

24 Nov 2005 GMT+05:30

What is the format code for this custom format in Excel?

I tried dd MMM yyyy with z,zz,zzz, and Z but Excel ignores those options.

解决方案

Not sure if possible. I've just gone through every letter in custom format cell and nothing looked right.

What I would suggest is maybe splitting it up into a few cells and then bringing them all together.

In the first column (A1) you could have the date, formatted how you like (dd mmm yyyy).

Second (B1) you could have the time before you account for the different timezone (formatted how you like, i.e. hh:mm:ss.

Third (C1) define if the timezone is ahead or behind with a plus/minus sign.

Fourth (D1) you could set the time difference (i.e. your example +5:30). Format the cell as h:mm.

Fifth (E1), enter the formula: =IF(C1="+",B1+D1,IF(C1="-",B1-D1)). Format the cell as hh:mm:ss.

Finally, (F1) there's two options for you. You can combine the date and time adjusted to the timezone, or you can combine the date, original time and include timezone.

The first option would be: =TEXT(A1,"dd mmm yyyy ")&TEXT(E2,"hh:mm:ss")

Second would be: =TEXT(A1,"dd mmm yyyy ")&TEXT(B1,"hh:mm:ss ")&"GMT"&TEXT(C1,"")&TEXT(D1,"h:mm")

This is the absolute best solution I could think of. Sorry if it's not what you asked for.

这篇关于在Excel中设置带时区的日期的格式代码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆