Date and Time Handling

Date and Time Handling

Telerik Platform support date and time values natively. Those values are represented as a java.util.Date objects in the Android SDK. There are several important settings related to date and time handling in the SDK.

By default, the SDK sends all Date objects to the server as UTC dates. This means that even if you specify a local date in your app, it will be converted to UTC and then sent to the server. Similarly, when you read dates from the server, they will be automatically converted to local dates.

Unless you have some specific requirements, we recommend you to use this default behavior. It is the most common use case, when the same data is consumed from thousands of devices in various time zones. Of course, you can change it. It can be set when creating an EverliveApp object. Here is an example:

var settings = new EverliveAppSettings(your-app-id);
settings.setInBoundDateTimeProcessing(DateTimeValuesProcessing.NoChanges);
settings.setOutBoundDateTimeProcessing(DateTimeValuesProcessing.NoChanges);
EverliveApp app = new EverliveApp(settings);

Another important setting is related to the handling of unspecified DateTime objects. Unspecified DateTime objects are those with Kind set to Unspecified. Such dates are not supported by Telerik Platform and must be processed before they are sent. The default setting will throw an exception when such a date is encountered.

We recommend you to keep this setting and always work with either UTC or local dates. For convenience we have included a setting that will automatically treat those dates as either UTC or Local. The setting for this behavior is again in the EverliveAppSettings instance:

var settings = new EverliveAppSettings(your-app-id);
settings.setDateTimeUnspecifiedHandling(DateTimeUnspecifiedHandling.TreatAsLocal);
EverliveApp app = new EverliveApp(settings);
Start a free trial Request a demo
Contact us: +1-888-365-2779
sales@telerik.com
Copyright © 2016-2017, Progress Software Corporation and/or its subsidiaries or affiliates. All rights reserved.