new Date()

Servoy gives a wrong date when I use the function “new Date()”.
The calculation “return new Date(2004,1,1,0,0,0);” gives “01-02-2004”.
Servoy gives a date 1 month later.

In the preferences the Date Format is: “dd-MM-yyyy”.

Do I something wrong or is this a bug?

Alexander Schrijvershof

In Java January=0, Feb=1, Mar=2 and so on…

It’s not a bug.

HTH
Stef

Alexander Schrijvershof:
Servoy gives a wrong date when I use the function “new Date()”.
The calculation “return new Date(2004,1,1,0,0,0);” gives “01-02-2004”.
Servoy gives a date 1 month later.

In the preferences the Date Format is: “dd-MM-yyyy”.

Do I something wrong or is this a bug?

Alexander Schrijvershof

The calculation:

var x = new Date(2004,1,1,0,0,0);
a.setUTCDate(0);
return a;

gives “01-01-2004”.

Can you tell me why?

Thank you,

Alexander

yes this is very curious behaviour i just tested it myself.
I still want to test that script in a internet browser to see what happens then.

It looks like the first time you set an utc date on a date of 1-x-xxxx that it does some strange things.

will investigate furter