search envelope-o feed check
Home Unanswered Active Tags New Question
user comment-o

Javascript Date To Daypilot Date Conversion

Asked by Shivprasad Acharya
6 years ago.

I have Javascript date, which I'm trying to convert to daypilot date but the Hour values are coming not correctly, can you please tell me how can we get correct date conversion value.

var currentDateTime=new Date;
>Tue Aug 22 2017 10:30:10 GMT+0530 (India Standard Time)

new DayPilot.Date(currentDateTime);
>DayPilot.Date {value: "2017-08-22T05:00:10.000"}

but I want it as "2017-08-22T10:30:10.000" rather than "2017-08-22T05:00:10.000" with GMT+0530 added.

Thank you.

Answer posted by Dan Letecky [DayPilot]
6 years ago.

The constructor has a second parameter which lets you specify whether to use the GMT base or local representation of Date object. This call will use the local representation:

var local = new DayPilot.Date(currentDateTime, true);

See also:
https://api.daypilot.org/daypilot-date-constructor/

This question is more than 1 months old and has been closed. Please create a new question if you have anything to add.