Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics CRM (Archived)

Java Script Datetime time zone issue..

(0) ShareShare
ReportReport
Posted on by Microsoft Employee

I need to set date time value for one of the field in an entity using Java Script. The time I want to set is 1 minute after current time. Below is the code for it. The problem I am getting is that when I go to Entity form for Batch to see the time that is set, the time it shows is 5 hours ahead of time that was set using below script. The alert message in the java script shows the correct time.

I know this is related to timezone but how to resolve this.

function scheduleBatch(BatchId){


var batch = {};
var dt = new Date();
dt.setMinutes(dt.getMinutes() + 1); // schedule after one minute of current date time

batch["rsfa_NextActivation"] = dt;

updateRecord(
BatchId,
batch,
"rsfa_batchprocess",
function () {
alert("The batch scheduled successfully for [" + dt + "]");
},
errorHandler
);

}

*This post is locked for comments

  • Suggested answer
    Community Member Profile Picture
    Community Member Microsoft Employee on at
  • Suggested answer
    Nadeeja Bomiriya Profile Picture
    Nadeeja Bomiriya 6,804 on at
    RE: Java Script Datetime time zone issue..

    Hi Noor,

    Click the Gear button > Options in see what your personal time zone setting is.  Make sure to set this to your timezone.

    Timezone.PNG

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Announcing Our 2025 Season 1 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Vahid Ghafarpour – Community Spotlight

We are excited to recognize Vahid Ghafarpour as our February 2025 Community…

Tip: Become a User Group leader!

Join the ranks of valued community UG leaders

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 292,494 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 231,305 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans