RE: [flexcoders] Increment Date

2005-02-09 Thread Dirk Eismann
Unfortunately it's not that straightforward. You need to call the 
setTime()method of the Date object you want to modify and pass in the new time 
in milliseconds. 

To add one hour (60 * 60 * 1000 ms) to dateObj

dateObj.setTime(dateObj.getTime() + 360);

To add a day (24 * 60 * 60 * 1000 ms) to dateObj

dateObj.setTime(dateObj.getTime() + 8640);

Dirk.

 -Original Message-
 From: kengaree [mailto:[EMAIL PROTECTED]
 Sent: Tuesday, February 08, 2005 8:56 PM
 To: flexcoders@yahoogroups.com
 Subject: [flexcoders] Increment Date
 
 
 
 
 Is there a way to increment the date in either the date object or 
 the datefield control?  
 
 Example: Jan 31, 2005 + 1 = Feb 1, 2005
 
 Thanks,
 Ken
 
 
 
 
 
  
 Yahoo! Groups Links
 
 
 
  
 
 
 
 




Re: [flexcoders] Increment Date

2005-02-09 Thread Manish Jethani
Dirk Eismann wrote:
To add a day (24 * 60 * 60 * 1000 ms) to dateObj
dateObj.setTime(dateObj.getTime() + 8640);
Why, it's not that bad!
// add a day to Jan 31, 2005
var d:Date = new Date(2005, 0, 31);
d.setDate(d.getDate() + 1);
alert(d.toString());
// displays Feb 1, 2005!
Manish



Re: [flexcoders] Increment Date

2005-02-08 Thread JesterXL
Hrm... maybe:

function nextDay(df:DateField):Void
{
var currentDate:Date = df.selectedDate;
currentDate.setDate(currentDate.getDate() + 1);
}

function nextMonth(df:DateField):Void
{
var currentDate:Date = df.selectedDate;
currentDate.setMonth(currentDate.getMonth() + 1);
}

???

- Original Message - 
From: kengaree [EMAIL PROTECTED]
To: flexcoders@yahoogroups.com
Sent: Tuesday, February 08, 2005 2:55 PM
Subject: [flexcoders] Increment Date




Is there a way to increment the date in either the date object or 
the datefield control? 

Example: Jan 31, 2005 + 1 = Feb 1, 2005

Thanks,
Ken






Yahoo! Groups Links










re: [flexcoders] Increment Date

2005-02-08 Thread Kevin Towes (New Toronto Group)
I use the getTime() and setTime() methods normally... but a GREAT idea would be to steal Dameon's ColdFusion routines for dateAdd() hint hintKev.Kevin Towes, Sr. ConsultantNew Toronto Group, [EMAIL PROTECTED]Office: 905-306-2790 Mobile: 416-882-4445[onRemote]  From: "kengaree" [EMAIL PROTECTED]Sent: February 8, 2005 12:55 PMTo: flexcoders@yahoogroups.comSubject: [flexcoders] Increment DateIs there a way to increment the datein either the date object or the datefield control? Example: Jan 31, 2005 + 1 = Feb 1, 2005Thanks,KenYahoo! Groups Links* Tovisit your group on the web, go to:http://groups.yahoo.com/group/flexcoders/* To unsubscribe from this group, send an emailto:[EMAIL PROTECTED]* Your use of Yahoo! Groups is subject to:http://docs.yahoo.com/info/terms/


Re: [flexcoders] Increment Date

2005-02-08 Thread JesterXL
Er, to modify:

function nextMonth(df:DateField):Void
{
var currentDate:Date = df.selectedDate;
currentDate.setMonth(currentDate.getMonth() + 1);
df.selectedDate = currentDate;
}

Forgot to re-assign the date. Anyway, those methods could be called form a 
Utilities class, or you could add them via a Decorator.


- Original Message - 
From: JesterXL [EMAIL PROTECTED]
To: flexcoders@yahoogroups.com
Sent: Tuesday, February 08, 2005 2:59 PM
Subject: Re: [flexcoders] Increment Date



Hrm... maybe:

function nextDay(df:DateField):Void
{
var currentDate:Date = df.selectedDate;
currentDate.setDate(currentDate.getDate() + 1);
}

function nextMonth(df:DateField):Void
{
var currentDate:Date = df.selectedDate;
currentDate.setMonth(currentDate.getMonth() + 1);
}

???

- Original Message - 
From: kengaree [EMAIL PROTECTED]
To: flexcoders@yahoogroups.com
Sent: Tuesday, February 08, 2005 2:55 PM
Subject: [flexcoders] Increment Date




Is there a way to increment the date in either the date object or
the datefield control?

Example: Jan 31, 2005 + 1 = Feb 1, 2005

Thanks,
Ken






Yahoo! Groups Links









Yahoo! Groups Links