我如何格式化日期时间或时区/的TimeZoneInfo显示三信吗? [英] How do I format DateTime or TimeZone/TimeZoneInfo to display Three letters?
问题描述
我正与一个规范,呼吁一个奇特的日期时间格式,我不一定有与没有工作。
I'm working with a spec that calls for a peculiar Datetime format that I haven't necessarily had to work with yet.
在处理的时候,一个OFX(1不2)日期时间必须加盖(无论是DTCLIENT或DTSERVER)在这样的格式:
20071015021529.000
At Process time, an OFX (1 not 2) datetime must be stamped (either DTCLIENT or DTSERVER) in a format like this:
20071015021529.000
然而,在实施例中示出:
however, in the examples it is shown:
20071015021529.000[-8:PST]
我没有与第一个使用的语句问题
I don't have a problem with the first one using a statement of
DateTime.Now.ToString("yyyyMMddHHmmss.fff")
我甚至可以弄清楚如何获得%Z
,以获得正确的偏移量。
I can even figure out how to get %z
to get the correct offset.
这三个字母时区code是在那里我绊倒了。有一个简单的方法来获得这个在.net中,还是我去年底写code输出和解析我需要什么?
The three letter timezone code is where I'm tripping up. Is there an easy way to get this in .net, or am I going to end up writing code to output and parse what I need?
推荐答案
您需要找出它需要到底是哪3个字母的codeS。什么欧洲/巴黎
给出,例如?就个人而言,我想将数据转换为UTC和格式化这种方式,除非你真的需要preserve时区信息。
You need to find out exactly which 3 letter codes it needs. What would Europe/Paris
give, for example? Personally, I'd convert the data to UTC and format it that way, unless you actually need to preserve the time zone information.
这篇关于我如何格式化日期时间或时区/的TimeZoneInfo显示三信吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!