Quantcast
Channel: CRM Development forum
Viewing all articles
Browse latest Browse all 8223

Silverlight DataServiceQuery TimeZone Conversion

$
0
0

I have the following DataServiceQuery running in a Silverlight applications:

query = (DataServiceQuery<ServiceAppointment>)LSLContext.ServiceAppointmentSet
.AddQueryOption("$select", "ActivityId,Subject,StateCode,ScheduledStart,ScheduledEnd")
.AddQueryOption("$expand", "Contact_ServiceAppointments,new_salesorder_serviceappointment_RelatedOrderID,serviceappointment_activity_parties")
.AddQueryOption("$orderby", "ScheduledStart")
.Where<ServiceAppointment>(a => (a.ScheduledStart.Value >= start && a.ScheduledStart.Value <= end) && (a.SiteId.Id == new Guid(selectedCenter.SiteId)) && (a.StateCode.Value == 0 || a.StateCode.Value == 1 || a.StateCode.Value == 3)); 

My main concern is in the .Where statement for the start and end values. These are currently datetime fields. The ScheduledStart field is in UTC time and I need to convert start and end to UTC based on a specific timezone. This timezone is known ahead of time and I currently have the UTCOffset/TimeZoneCode available as I have the SiteID and BusinessUnitID available.

The specific timezone is not tied to the user running the application or the timezone their computer is in. I have a list of BusinessUnits and they select a specific location. I then load appointments for that location based on that locations time.

How should I convert these values from a specific timezone to UTC? For example, start is 6/7/2013 10:00AM Central Standard Time and needs to be UTC based on CST. Can I convert it in the Where statement or should it be done before it?

Thanks



Viewing all articles
Browse latest Browse all 8223

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>