Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

why im i getting errors

Guest
Aug 08, 2016 Aug 08, 2016

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());

TOPICS
Acrobat SDK and JavaScript
829
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Community Expert , Aug 08, 2016 Aug 08, 2016

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());

Translate
Community Expert ,
Aug 08, 2016 Aug 08, 2016

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);

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Aug 08, 2016 Aug 08, 2016

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());

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Aug 08, 2016 Aug 08, 2016

not sure if Im setup correctly, but everything I seem to enter into the console I get errors!

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Aug 08, 2016 Aug 08, 2016

The code I posted above works. If you're getting an error running it from the console post the complete error message here.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Aug 08, 2016 Aug 08, 2016

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

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Aug 08, 2016 Aug 08, 2016

That's not the code I provided.

On Mon, Aug 8, 2016 at 10:58 PM, dave247g39278683 <forums_noreply@adobe.com>

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Aug 08, 2016 Aug 08, 2016

I don't see your code try67

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Aug 08, 2016 Aug 08, 2016

It's in my second reply to this thread.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Aug 08, 2016 Aug 08, 2016
LATEST

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! 🙂

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Aug 08, 2016 Aug 08, 2016

why the Currently being moderated. now?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Aug 08, 2016 Aug 08, 2016

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

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Employee ,
Aug 08, 2016 Aug 08, 2016

I don’t see finalTime defined anywhere in that code – so that error makes sense.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Aug 08, 2016 Aug 08, 2016

how do I define the code Staff so I know Im setup correctly please?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Employee ,
Aug 08, 2016 Aug 08, 2016

Where is this code? How it is being called? What errors?

And what does this have to do with the SDK?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines