web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

Session Id :
Customer experience | Sales, Customer Insights,...
Answered

how to substract 5.30 hours from date through javascript in crm 2015

(0) ShareShare
ReportReport
Posted on by 125

I need to subtract 5 hours 30 min from the final date 

var finalDate = Date.parse(dateTime);
var dateslot = new Date(finalDate).subTime(5, 30);// I am using this but it is not supported 


Xrm.Page.getAttribute("preferredvisittime").setValue(dateslot);

How to do that please help me 

I have the same question (0)
  • Verified answer
    Community Member Profile Picture
    on at

    Hi NehaGupta,

    You can try to use getHours() and getMinutes() to achieve it. Just like following shown:

    var date = new Date("Fri Jan 15 2016 00:00:00");

    date.setHours(date.getHours()-5);

    date.setMinutes(date.getMinutes()-30);

    Regards,

    Leah Ju

    Please mark as verified if the answer is helpful. Welcome to join hot discussions in Dynamics 365 Forums.
  • Verified answer
    Community Member Profile Picture
    on at

    Hi Partner,

    Has the problem been solved? Any updates?

    Please click Yes under "Did this answer your question?" to close this thread.

    pastedimage1598515795213v1.png

    Thanks. 

    Regards,

    Leah Ju

    Please mark as verified if the answer is helpful. Welcome to join hot discussions in Dynamics 365 Forums.

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Stars!

Meet the Microsoft Dynamics 365 Contact Center Champions

We are thrilled to have these Champions in our Community!

Congratulations to the March Top 10 Community Leaders

These are the community rock stars!

Leaderboard > Customer experience | Sales, Customer Insights, CRM

#1
ManoVerse Profile Picture

ManoVerse 151 Super User 2026 Season 1

#2
11manish Profile Picture

11manish 134

#3
Jimmy Passeti Profile Picture

Jimmy Passeti 55 Most Valuable Professional

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans