convert

Adds the time difference between two timezones to a new date object.

Parameters

targetDate Date

The date that will be converted with the time difference between two timezones.

fromOffset Number|String

The 'from' offset represented as minutes (that is, the Number type) or timezone (that is, String).

toOffset Number|String

The 'to' offset represented as minutes (that is, the Number type) or timezone (that is, String).

Returns

Date A new date object that includes the time difference between two timezones.

Example

<script>
    // include kendo.timezones.js
    var version = kendo.version;

    $('<script/>', { 
        type:'text/javascript', 
        src:'https://kendo.cdn.telerik.com/'+version+'/js/kendo.timezones.min.js'
    }).appendTo('head');
</script>

<script>
    var targetDate = new Date(2016,10,5,15,25,11);
    var convertedDate1 = kendo.timezone.convert(targetDate, "Etc/GMT+2", "Etc/GMT-6");
    var convertedDate2 = kendo.timezone.convert(targetDate, 120, -360);

/* The result can be observed in the DevTools(F12) console of the browser. */
    console.log(convertedDate1); // Sat Nov 05 2016 23:25:11 GMT+0200 (FLE Standard Time);
/* The result can be observed in the DevTools(F12) console of the browser. */
    console.log(convertedDate2); // Sat Nov 05 2016 23:25:11 GMT+0200 (FLE Standard Time);
</script>
In this article