have to be UTC date time?

47 views
Skip to first unread message

灵感之源

unread,
Dec 22, 2009, 12:54:30 AM12/22/09
to quar...@googlegroups.com
Hi,

in the simple example:

TriggerUtils.GetEvenMinuteDate(DateTime.UtcNow); //it's ok

but

TriggerUtils.GetEvenMinuteDate(DateTime.Now); //I wait for long
time, it does not run. I am ing GMT+8

It seems that the behavior has been changed since last version.
Do I really have to manually convert local time to UTC time?

warriorpostman

unread,
Dec 22, 2009, 1:31:42 AM12/22/09
to Quartz.NET
I'm running with the previous version of Quartz.NET, and as far as I
know, triggers have always required using UTC date/times. Although,
you shouldn't have to convert it manually, as I believe there is some
sort of function in the .NET framework that will easily convert local
times to UTC time. Do a quick google for it, and I'm sure you'll find
it.

Brendan Richards

unread,
Dec 22, 2009, 7:02:41 AM12/22/09
to quar...@googlegroups.com
Although possibly sliding slightly off-topic, I personally found timezone conversion tricky enough to warrant sharing...

What I've always found easy is converting UTC to/from local time - theres a function just there in .net.
Dealing with users in differing timezones becomes more complicated.

I've just found out that .net 3.5 includes a TimezoneInformation class.
http://msdn.microsoft.com/en-us/library/system.timezoneinfo.aspx

but I've always used this:
http://www.codeproject.com/KB/vb/TimeZoneInfo.aspx

At first glance this whole issue sounds like it should be easy but is actually tricky because timezone conversion also needs to take Daylight Savings into account. What the above classes do is pull timezone and DST info from the windows registry. The main advantage here being that changes to any country's daylight saving will be automatically pushed to your computer with standard widows updates.

Once you've got this class you then need to get your head around what the various timezones are called. The timezone names don't match what you see in the windows settings screen - I actually had to use the above class just to get me a list!
I've got to work with the following in one app I've developed:
Tasmania Standard Time
E. Australia Standard Time
AUS Eastern Standard Time
Cen. Australia Standard Time
We've got some states that have DST and some that don't.
I eventually added a helper class so I could reference timezones directly by city:
AustralianTimezones.Brisbane returning you "E. Australia Standard Time"

I've since found this link but don't know how accurate or up-to-date this is:
http://www.netresultstracker.com/pthelp55/Install/wms_tz_2000.htm


Hope this helps,

Brendan


warriorpostman wrote:
I'm running with the previous version of Quartz.NET, and as far as I
know, triggers have always required using UTC date/times.  Although,
you shouldn't have to convert it manually, as I believe there is some
sort of function in the .NET framework that will easily convert local
times to UTC time.  Do a quick google for it, and I'm sure you'll find
it.

On Dec 21, 9:54 pm, ���֮Դ <unruled...@gmail.com> wrote:
  
Hi,

     in the simple example:

     TriggerUtils.GetEvenMinuteDate(DateTime.UtcNow);  //it's ok

     but

     TriggerUtils.GetEvenMinuteDate(DateTime.Now);   //I wait for long
time, it does not run. I am ing GMT+8

     It seems that the behavior has been changed since last version.
Do I really have to manually convert local time to UTC time?
    
--

You received this message because you are subscribed to the Google Groups "Quartz.NET" group.
To post to this group, send email to quar...@googlegroups.com.
To unsubscribe from this group, send email to quartznet+...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/quartznet?hl=en.


  

Reply all
Reply to author
Forward
0 new messages