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

Adding days to a date object

New Here ,
Nov 27, 2010 Nov 27, 2010

Copy link to clipboard

Copied

Hi all.

I realy tryed to look for this in the forum but since it's so difficult to find anything here i decided to open a new discussion about this.

I'm having problems adding a day to a certain date. I tried everything, but prob not the right code.

Anyway...let's go to the point.

myDate:Date = new Date(20, 11, 2011)

myDate.getDate() // output: 20

myDate.getMonth() // output: 11

myDate.getFullYear() // output: 2011

Now i tried everythink i know to add, for example, 10 days:

One of the attempts:

myDate.getDate()+1

myDate.getDate// output: 12

myDate.getMonth() // output: 0 (Zero)

myDate=getFulYear() // output: 2011

I'm sure someone already made something like this.

If you are one of those persons please please help me

Views

430

Translate

Translate

Report

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
New Here ,
Nov 27, 2010 Nov 27, 2010

Copy link to clipboard

Copied

LATEST

I am realy stupit!!

Why I don't read all the documentation?????

So just for the records:

getMonth() methond on Date class returns a value from 0 to 11 when 0 is Jan and 11 is Dec.

My setDate(20, 11, 2010) says 20 of Dec of 2010

Thanks anyway

SOLVED!!

Votes

Translate

Translate

Report

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