这个时间值在什么格式? [英] What format is this time value in?

查看:163
本文介绍了这个时间值在什么格式?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个WMI查询,以这种格式指定时间'20090219000000.000000 + 480'



有人可以告诉我这是什么格式,并且.NET有任何内置 - 功能可以使用吗?



编辑



此时间值为从我发现的样本查询。我不知道用什么时间值来生成它。我只需要能够将时间值转换成这种格式。



编辑2



我发现这次是在 CIM_DATETIME 格式

解决方案

这看起来像没有任何分隔符的标准日期时间字符串:



'20090219000000.000000 + 480'



'yyyyMMddhhmmss.ffffff + 480'



yyyy - 一年四位数。

MM - 数字月份。单位数月份领先零位。

dd - 一个月的日子。单位数天数为零。

hh - 12小时制的时间。单位数小时数为零。 (这也可以是HH,这是24小时制的小时,单位数小时为零)。

mm - 分钟。单位数分钟有一个前导零。

ffffff - 六位数精度的秒数。



+480很可能是时区指标,尽管不是标准的。通常,时区以UTC(或小时和分钟)为单位表示。这看起来可能只有几分钟。因此,没有标准的格式说明符。



.NET中的DateTime类可用于处理此值。但是,您可能希望在将剩余字符串解析为实际的DateTime变量之前,先取消+480部分。然后,您可以将其调整到正确的时区,或提前进行时区转换(从分钟到小时/分钟),并将+480更改为正确的时区表示,然后将所有内容传递给DateTime.Parse。 p>

I have a WMI query that specifies time in this format '20090219000000.000000+480'

Can someone tell me what format this is, and does .NET have any built-in functionality to work with it?

EDIT

This time value is from a sample query that I found. I don't know what time value was used to generate it. I just need to be able to convert a time value to this format.

EDIT 2

I found out this time is in CIM_DATETIME format.

解决方案

This looks like a standard date time string without any separators:

'20090219000000.000000+480'

'yyyyMMddhhmmss.ffffff+480'

yyyy - The year in four digits.
MM - The numeric month. Single-digit months have a leading zero.
dd - The day of the month. Single-digit days have a leading zero.
hh - The hour in a 12-hour clock. Single-digit hours have a leading zero. (This could also be HH, which is the hour in a 24-hour clock with single-digit hours having a leading zero.)
mm - The minute. Single-digit minutes have a leading zero.
ffffff - The fraction of a second in six-digit precision.

The "+480" is most likely a timezone indicator, although not a standard one. Normally time zones are represented as hours (or hours and minutes) from UTC. This appears to probably only be minutes. As such, there is no standard format specifier.

The DateTime class in .NET is what you would use to work with this value. However, you would probably want to take the "+480" portion off before parsing the remaining string in to an actual DateTime variable. You can then adjust it to the correct timezone or perform the timezone conversion (from minutes to hours/minutes) ahead of time and change the "+480" to the correct timezone representation and then pass the whole thing to DateTime.Parse.

这篇关于这个时间值在什么格式?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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