Introduction

All events recorded by the Cloud App Licenser API are stored in Coordinated Universal Time (UTC). Any requests to the API that return JSON data containing date/time values include the option to offset the date/time returned to match the user's local timezone (as set for their device). For example, you could offset the time by 300 if the user's timezone is five hours ahead of UTC. You therefore need a way of finding out your users' local timezone settings.

Using moment.js

An easy way of finding out a user's device timezone is by including the Moment.js JavaScript library in your application and simply defining the UTC offset of the device:


var timeoffset = moment().utcOffset();

You can pass this value directly to the Cloud App Licenser API as the value for the number of minutes to offset any date/time values (where applicable).