Copy link to clipboard
Copied
why Am I getting errors with this code?
I don't understand why!
var rightNow = new Date();
var msRightNow = rightNow.getTime();
var fiveDays = 5 * 24 * 60 * 60 * 1000;
var theNewDate = new Date(finalTime);
console.println("5 days from now is: " + theNewDate.toString());
Sorry, I do see an error now. You didn't define the finalTime variable anywhere. I think you meant to do something like this:
var rightNow = new Date();
var msRightNow = rightNow.getTime();
var fiveDays = 5 * 24 * 60 * 60 * 1000;
var finalTime = msRightNow + fiveDays;
var theNewDate = new Date(finalTime);
console.println("5 days from now is: " + theNewDate.toString());
Copy link to clipboard
Copied
First of all, I moved your question to the JavaScript forum.
I don't see any errors in this code, but it is not set up to work correctly.
You need to add the fiveDays value to the msRightNow value if you want to get the date for five days from now.
So the fourth line should be:
var theNewDate = new Date(msRightNow + finalTime);
Copy link to clipboard
Copied
Sorry, I do see an error now. You didn't define the finalTime variable anywhere. I think you meant to do something like this:
var rightNow = new Date();
var msRightNow = rightNow.getTime();
var fiveDays = 5 * 24 * 60 * 60 * 1000;
var finalTime = msRightNow + fiveDays;
var theNewDate = new Date(finalTime);
console.println("5 days from now is: " + theNewDate.toString());
Copy link to clipboard
Copied
not sure if Im setup correctly, but everything I seem to enter into the console I get errors!
Copy link to clipboard
Copied
The code I posted above works. If you're getting an error running it from the console post the complete error message here.
Copy link to clipboard
Copied
var rightNow = new Date();
var msRightNow = rightNow.getTime();
var fiveDays = 5 * 24 * 60 * 60 * 1000;
var theNewDate = new Date(finalTime);
console.println("5 days from now is: " + theNewDate.toString());
ReferenceError: finalTime is not defined
4:Console:Exec
undefined
Copy link to clipboard
Copied
That's not the code I provided.
On Mon, Aug 8, 2016 at 10:58 PM, dave247g39278683 <forums_noreply@adobe.com>
Copy link to clipboard
Copied
I don't see your code try67
Copy link to clipboard
Copied
It's in my second reply to this thread.
Copy link to clipboard
Copied
Thank you Try67 that is working!
Im trying t0 work and fig the code to get it to do a 30 day date to the text field. From todays date.
Been a long time since I 've used code, and its not my best subject! 🙂
Copy link to clipboard
Copied
why the Currently being moderated. now?
Copy link to clipboard
Copied
The Jive software that Adobe uses for the forums moderates all new user, and any message that contains something the Jive spam filter does not recognize
Copy link to clipboard
Copied
I don’t see finalTime defined anywhere in that code – so that error makes sense.
Copy link to clipboard
Copied
how do I define the code Staff so I know Im setup correctly please?
Copy link to clipboard
Copied
Where is this code? How it is being called? What errors?
And what does this have to do with the SDK?
Find more inspiration, events, and resources on the new Adobe Community
Explore Now