Click here to Skip to main content
16,007,809 members
Home / Discussions / Web Development
   

Web Development

 
GeneralRe: Regular Expressions Pin
Javier Lozano22-Jul-04 14:14
Javier Lozano22-Jul-04 14:14 
GeneralTextArea and <HTML> tag Pin
devvvy20-Jul-04 20:13
devvvy20-Jul-04 20:13 
GeneralRe: TextArea and <HTML> tag Pin
alex.barylski23-Jul-04 18:49
alex.barylski23-Jul-04 18:49 
GeneralClientSide JavaScript HTML Tag Pin
gmhanna20-Jul-04 18:20
gmhanna20-Jul-04 18:20 
GeneralRe: ClientSide JavaScript HTML Tag Pin
alex.barylski23-Jul-04 18:50
alex.barylski23-Jul-04 18:50 
GeneralRe: ClientSide JavaScript HTML Tag Pin
mysorian16-Aug-04 16:43
professionalmysorian16-Aug-04 16:43 
GeneralCalculating Variance excluding non-working days Pin
Ph@ntom20-Jul-04 17:03
Ph@ntom20-Jul-04 17:03 
GeneralRe: Calculating Variance excluding non-working days Pin
Alexander Wiseman2-Aug-04 7:14
Alexander Wiseman2-Aug-04 7:14 
GeneralProblem in playing MPEG-2 video in browser Pin
ckhjacky20-Jul-04 7:50
ckhjacky20-Jul-04 7:50 
Generalshould JMF be installed in all client PC Pin
karthik prasanna20-Jul-04 3:08
karthik prasanna20-Jul-04 3:08 
GeneralAdding number of days to a Date Pin
Ph@ntom19-Jul-04 20:34
Ph@ntom19-Jul-04 20:34 
GeneralRe: Adding number of days to a Date Pin
Alexander Wiseman20-Jul-04 4:29
Alexander Wiseman20-Jul-04 4:29 
GeneralRe: Adding number of days to a Date Pin
Ph@ntom20-Jul-04 16:59
Ph@ntom20-Jul-04 16:59 
GeneralRe: Adding number of days to a Date Pin
Ph@ntom20-Jul-04 19:13
Ph@ntom20-Jul-04 19:13 
GeneralRe: Adding number of days to a Date Pin
Alexander Wiseman21-Jul-04 3:31
Alexander Wiseman21-Jul-04 3:31 
GeneralRe: Adding number of days to a Date Pin
Ph@ntom23-Jul-04 17:48
Ph@ntom23-Jul-04 17:48 
GeneralRe: Adding number of days to a Date Pin
Alexander Wiseman25-Jul-04 3:22
Alexander Wiseman25-Jul-04 3:22 
GeneralRe: Adding number of days to a Date Pin
Ph@ntom25-Jul-04 6:16
Ph@ntom25-Jul-04 6:16 
GeneralRe: Adding number of days to a Date Pin
Ph@ntom26-Jul-04 6:12
Ph@ntom26-Jul-04 6:12 
GeneralRe: Adding number of days to a Date Pin
Alexander Wiseman27-Jul-04 8:00
Alexander Wiseman27-Jul-04 8:00 
GeneralRe: Adding number of days to a Date Pin
Ph@ntom27-Jul-04 19:40
Ph@ntom27-Jul-04 19:40 
GeneralRe: Adding number of days to a Date Pin
Alexander Wiseman28-Jul-04 4:31
Alexander Wiseman28-Jul-04 4:31 
Hey,

I have looked through your code and discovered why the month is being decreased by 1. You were exactly right when you said that the getMonth() function returns the zero-based index of the month. Your formatting functions assume a one-based index of the month, which means that the when you call FormatDate after the call to AddDayToDate, the month gets set back by 1 (July becomes June, in your test scenario).

Fortunately, there is an easy way to fix this and I have tested it to make sure it works. You need to modify the AddDayToDate function to add one to the month returned by getMonth. Below you will find the modified version of AddDayToDate. Copy it into your code and it should work fine.

// Definition of AddDayToDate
function AddDayToDate(plandate, days)
{
    var gCurrentDate = new Date(plandate);

    var newDate = DateAdd(gCurrentDate, parseInt(days,10), 
    parseInt(0,10), 
    parseInt(0,10)); 

    var year = newDate.getFullYear() ; 

    //The changed line: note the +1 to get the month in a one based index
    var month = newDate.getMonth() + 1 ;

    var date = newDate.getDate() ;

    return date + "/" + month + "/" + year ;
}


Hope that helps! Let me know if it still doesn't work. Also, I haven't had a chance, but I plan to work on the DateVariance function. I already know how to go about it, so it will just be a matter of sitting down and writing the code when I have a free moment.

Sincerely,
Alexander Wiseman
GeneralRe: Adding number of days to a Date Pin
Ph@ntom30-Jul-04 18:57
Ph@ntom30-Jul-04 18:57 
GeneralRe: Adding number of days to a Date Pin
Alexander Wiseman2-Aug-04 7:15
Alexander Wiseman2-Aug-04 7:15 
GeneralCalling Web Services from a web page Pin
NiteShade19-Jul-04 6:36
NiteShade19-Jul-04 6:36 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.