Click here to Skip to main content
16,005,060 members
Home / Discussions / Web Development
   

Web Development

 
GeneralRegular Expressions Pin
jazz081521-Jul-04 5:01
jazz081521-Jul-04 5:01 
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 
This is my code for calculating Variance between two dates


function presentDate(startDate, endDate) {<br />
    var ierr = 1 ;<br />
    <br />
   // Verify whether the user wants to return only whole<br />
   // intervals or intervals rounded to the nearest number <br />
   // of interval.<br />
   var roundDays = 1 ;<br />
   <br />
   // Verify that the user entered something in the<br />
   // Start Date input box.<br />
    if(startDate != '') {<br />
        if(!isNaN(Date.parse( startDate ))) {<br />
            var s = new Date(Date.parse(startDate)) ;<br />
            ierr = 0 ;<br />
        }<br />
    }<br />
    <br />
    // Verify that the user entered something in the<br />
   // Ending Date input box.<br />
    if(endDate != '' && ierr != 1) {<br />
        if(!isNaN(Date.parse( endDate ))) {<br />
            var e = new Date(Date.parse(endDate)) ;<br />
            <br />
            // call the dateDiff function.<br />
            var temp = suycDateDiff( s, e, 'd', roundDays ) ;<br />
        }else{<br />
            ierr = 1;<br />
        }<br />
    }else{<br />
        ierr = 1;<br />
    }<br />
    <br />
    // update the tellTime field with our new value.<br />
    if ( temp != null && ierr != 1 ) <br />
    <br />
    return temp.toString() ;<br />
}<br />
<br />
function suycDateDiff( start, end, interval, rounding ) {<br />
<br />
    var iOut = 0;<br />
    <br />
    // Create 2 error messages, 1 for each argument. <br />
    var startMsg = "Check the Start Date and End Date\n"<br />
        startMsg += "must be a valid date format.\n\n"<br />
        startMsg += "Please try again." ;<br />
		<br />
    var intervalMsg = "Sorry the dateAdd function only accepts\n"<br />
        intervalMsg += "d, h, m OR s intervals.\n\n"<br />
        intervalMsg += "Please try again." ;<br />
<br />
    var bufferA = Date.parse( start ) ;<br />
    var bufferB = Date.parse( end ) ;<br />
    	<br />
    // check that the start parameter is a valid Date. <br />
    if ( isNaN (bufferA) || isNaN (bufferB) ) {<br />
        alert( startMsg ) ;<br />
        return null ;<br />
    }<br />
	<br />
    // check that an interval parameter was not numeric. <br />
    if ( interval.charAt == 'undefined' ) {<br />
        // the user specified an incorrect interval, handle the error. <br />
        alert( intervalMsg ) ;<br />
        return null ;<br />
    }<br />
    <br />
    var number = bufferB-bufferA ;<br />
    <br />
    // what kind of add to do? <br />
    switch (interval.charAt(0))<br />
    {<br />
        case 'd': case 'D': <br />
            iOut = parseInt(number / 86400000) ;<br />
            if(rounding) iOut += parseInt((number % 86400000)/43200001) ;<br />
            break ;<br />
        case 'h': case 'H':<br />
            iOut = parseInt(number / 3600000 ) ;<br />
            if(rounding) iOut += parseInt((number % 3600000)/1800001) ;<br />
            break ;<br />
        case 'm': case 'M':<br />
            iOut = parseInt(number / 60000 ) ;<br />
            if(rounding) iOut += parseInt((number % 60000)/30001) ;<br />
            break ;<br />
        case 's': case 'S':<br />
            iOut = parseInt(number / 1000 ) ;<br />
            if(rounding) iOut += parseInt((number % 1000)/501) ;<br />
            break ;<br />
        default:<br />
        // If we get to here then the interval parameter<br />
        // didn't meet the d,h,m,s criteria.  Handle<br />
        // the error. 		<br />
        alert(intervalMsg) ;<br />
        return null ;<br />
    }<br />
    <br />
    return iOut ;<br />
}


Now again, I need to find the variance between these two dates excluding the non-working days i.e Thirsday and Friday.

Help kindly appreciated.

Regards,


The Phantom.
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 
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 

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.