Quantcast
Channel: Microsoft Dynamics CRM Forum - Recent Threads
Viewing all articles
Browse latest Browse all 46379

Javascript to add one hour to NOW in CRM

$
0
0

I want to take Date.now and add 1 hour.  This is my script:

var now2 = Date();
now2.setHours(now.getHours() + 1);
Xrm.Page.getAttribute("new_todaysdate").setValue(now2);

When it executes, page says there is no function for getHours.  HUH?  I thought that's supported JS.

So then i tried this:

// From: stackoverflow.com/.../how-to-add-30-minutes-to-a-javascript-date-object
var now = Date.now();
var now2 = new Date(now.getTime() + 60 * 60000);
Xrm.Page.getAttribute("new_todaysdate").setValue(now2);

Same type of error.  Says getTime is not a function.  Again, this says it is: http://www.w3schools.com/jsref/jsref_gettime.asp

What am i doing wrong?

Thank you


Viewing all articles
Browse latest Browse all 46379

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>