0

enter image description here

var liEnum = colListItem.getEnumerator();

    while(liEnum.moveNext())
    {
        var oLiCal=liEnum.get_current();                                   
        var eventStartDate = oLiCal.get_item('EventDate');  
        var eventEndDate = oLiCal.get_item('EndDate');  

        var eventStartDateLocaleString = eventStartDate.toLocaleString();
        var eventEndDateLocaleString = eventEndDate.toLocaleString();

        console.log("server start date is: " + eventStartDate); 
        console.log("local start date is: " + eventStartDateLocaleString);

        console.log("server start end date is: " + eventEndDate);
        console.log("local end date is: " + eventEndDateLocaleString);

The result I get is the following:

enter image description here

I am located at central time zone.

1

I'd recommend Moment.js. MomentJS

It's a fantastic lightweight library I've used many times within a SP context, handy for those ISO formatted dates.

Usage:

var dateformat = "DD MMMM YYYY"; var formattedDate = moment(eventStartDate).format(dateformat);

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.