Date function problem

Hi, i have a date variable
dDataIn = Tue Jul 05 00:00:00 CEST 2011
i need to get from this date the last day of the month (ie 30-06-2011)
i have used Date() function in this way
var dNewData = Date(dDataIn.getFullYear(),dDataIn.getMonth(),30)
but the new variable has this value
Mon May 30 2011 17:40:21 GMT+0200 (CEST)

Why ?
In the Debug
i have dDataIn.getFullYear() → 2011.0
dDataIn.getMonth() → 6

Why not 30-6-2011 ?

Thanks

I missed the new clause…
var dNewData = new Date(dDataIn.getFullYear(),dDataIn.getMonth(),30)

Another question…
I have my date variable and i wan to sum a number of days to that date…
In Visual Foxpro (the language i have evere used) i used
dVar = dVar + 60

In servoy ?

Hi michele,

michele:
I have my date variable and i wan to sum a number of days to that date…
In Visual Foxpro (the language i have evere used) i used
dVar = dVar + 60

In servoy ?

In JavaScript (and therefor Servoy) you can do it the following way:

dVar = new Date(dVar.getFullYear(), dVar.getMonth(), dVar.getDate() + 60); // add 60 days

Of course you could also use the mod_datejs module from Greg Pierce, which is based on the open source library datejs.
Then you can use the following syntax:

dVar.addDays(60);

Hope this helps.