使用DateTimeOffset [英] Working with DateTimeOffset

查看:173
本文介绍了使用DateTimeOffset的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在理解DateTimeOffset时遇到了一些问题...

I have some problems understanding the DateTimeOffset...

我正在尝试为石英作业创建简单触发。
存在一个triggerbuilder,通过它可以创建这样的触发器:

I am trying to create a simple-trigger for a Quartz-Job. There exists a triggerbuilder with which one can create such a trigger like this:

var triggerbuilder =
                TriggerBuilder.Create()
                .WithIdentity(triggerName, ConstantDefinitions.InternalDefinitions.AdhocJobGroup)
                .StartAt(new DateTimeOffset(scheduledTime));

ScheduledTime是一个DateTime。假设这是新的DateTime(2014、10、15、14、0、0);

The scheduledTime is a DateTime. Let's say it is new DateTime(2014, 10, 15, 14, 0, 0);

我住在中欧时区(UTC + 01:00)的城市中。

I live in a city which lies in the Central European Time Zone (UTC+01:00).

我打印时

var dto = new DateTimeOffset(new DateTime(2014, 10, 15, 14, 0, 0));
Console.WriteLine(dto);

我得到以下结果:


15.10.2014 14:00:00 +02:00

15.10.2014 14:00:00 +02:00

+02:00到底是什么意思?为什么是+2:00而不是+01:00?
这是否意味着我的触发器将在16:00而不是14:00开始?

What does the +02:00 exactly mean? And why is it +2:00 and not +01:00? Does that mean, that my trigger will be started at 16:00 instead of 14:00?

预先感谢

推荐答案

15.10.2014 14:00:00 +02:00 是datetimeoffset(datetime +时区)表示+2 UTC时区中的当地时间下午2点

15.10.2014 14:00:00 +02:00 is a datetimeoffset (datetime + timezone) representing 2pm local time in a timezone of +2 UTC

这相当于 15.10.2014 12:00:00 以UTC为单位

this is equivalent to 15.10.2014 12:00:00 in UTC

关于为什么是 +02:00 而不是 + 01:00 ,是否启用夏令时?

With regard to why is it +02:00 rather than +01:00, is daylight savings active?

在DateTime和DateTimeOffset之间转换

这篇关于使用DateTimeOffset的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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