or date.setMonth( date.getMonth() - 1 ) if you want to change the date object itself
Cheers Ralf. On Mon, Feb 11, 2008 at 6:22 PM, Ralf Bokelberg <[EMAIL PROTECTED]> wrote: > newDate = new Date( oldDate.getYear(), oldDate.getMonth() - 1, > oldDate.getDate()); > > Cheers > Ralf. > > > > > On Mon, Feb 11, 2008 at 5:08 PM, M.Javed <[EMAIL PROTECTED]> wrote: > > > > > > > > > > > > > > > > Hi, > > I have to substract 1 Month from the Date object, iam currently using the > > SetTime() method of date object as follows, but its giving some abnormal > > result by adding few days instead of substracting. > > ------------------------------------------------------- > > var date:Date = new Date(); > > var monthSpan:int = 1000 * 60 * 60 * 24 * 30; > > > > this.esView.toDateE.text = date.toDateString(); > > date.setTime(date.getTime() - monthSpan); > > this.esView.fromDateE.text = date.toDateString(); > > -------------------------------------------------------- > > > > the result in the fromDate TextBox should be one month previous date as > > compared to the current date. but it doesnt, any idea? > > ________________________________ > > Never miss a thing. Make Yahoo your homepage. > > > > -- > Ralf Bokelberg <[EMAIL PROTECTED]> > Flex & Flash Consultant based in Cologne/Germany > -- Ralf Bokelberg <[EMAIL PROTECTED]> Flex & Flash Consultant based in Cologne/Germany

