Wednesday, September 26, 2012

I NEED GetDaylightChanges

I NEED GetDaylightChanges

.Net has a TimeZone info for GetDaylightChanges.  I can't find it in Silverlight.  I hope it is somewhere that I can't find and NOT that someone decided not to publish the information that it obviously has.

I need to tell a server in a different timezone when the timezone where the Silverlight app is being run what datetimes are daylight savings time.  The SL app is just preparing information for a scheduler that runs on the server.  The server needs to know how to adjust scheduled times from multiple clients run in multiple timezones.

It isn't sufficient to know if the SL CURRENTLY is in DST which seems to be all that SL is willing to give up.

Please tell me there is an easy way to get this information in SL.

Answers & Comments...

Answer: 1

Hi, it seems that GetDaylightChanges is not supported in Silverlight so far, but I think you can build a WCF web service for you Silverlight to adjust scheduled times from multiple clients run in multiple timezones.

Here is a link that may help you: http://pholpar.wordpress.com/2011/01/29/how-to-get-the-assembly-version-number-from-the-build-date-and-vice-versa/ 



Answer: 2

Your link is missing and I don't see how a web service could help.  The server may be running on an entirely different time zone.  What I did was write a little wpf app that the user can use SL to download and that app puts all the information in the clipboard.  Then they can use SL's clipboard to read it in.

Multi-step solution and I don't like it, but it looks like it can't be done just in SL.

Would be really interesting to see that link.



Answer: 3

Have you tried bypassing the timezone+DST stuff and just use UTC?  Sounds  like it would be a lot simpler in this case.



Answer: 4

UTC is what was the source of problems in the first place.  I started off simply.  I had local times in my app.  I stored it on the server.  That worked fine on a local server.  Now the server is in a different time zone.  So when the client says start the app at 9am, the server won't see that time until 10am. 

So then I converted into and out of UTCs from the local client.  Now when the client says 9am, the server is told the UTC time.  So the server will schedule at a time that matches the clients 9am request.  And this works for all clients and all locations of servers.

There is at least one problem.  One of the schedule patterns is to schedule on a specific day/days.  So my customer said, schedule one at 9PM.  The UTC time was 1AM of the next day.  That part is fine.  The schedule is evaluated at the time the client wanted.  BUT the UTC time is a different DAY. 

So if the client wants it scheduled only on Sundays, at 9:01PM on Saturday, the UTC is 1:01AM Sunday.  So the TIME criteria to schedule is correct, but then when I ask the UTC what DAY it is, it says SUNDAY and off goes the job on the CLIENT'S Saturday when he wanted Sunday.

So now I am trying to get the local time information as in the UTC Offset, the Start and End datetime for Daylight Savings Time, and the Delta for the DST (which can be things like 1 hour, but can also be things like 1/2 hour).

So I will then convert the UTC back to the original requester's local time so that I can get the DAY in local time.

So, bottom line, I started out with local time only, switched to UTC on the server with translation in and out on the client, and that broke my scheduler, and I need the local time zone information.

Hence my need for GetDaylightChanges.

My solution is to provide a downloadable WPF app that gets the DST information and puts it in the clipboard.  Then the SL app can copy the clipboard and persist that info to the IsolatedStorage.  From then on, it can be stored with the schedule request so the corrections can be made.



Answer: 5

mmjj

Hi, it seems that GetDaylightChanges is not supported in Silverlight so far, but I think you can build a WCF web service for you Silverlight to adjust scheduled times from multiple clients run in multiple timezones.

Here is a link that may help you: http://pholpar.wordpress.com/2011/01/29/how-to-get-the-assembly-version-number-from-the-build-date-and-vice-versa/ 

That link would seem to have nothing to do with time.





No comments:

Post a Comment

Send us your comment related to the topic mentioned on the blog