How to set date format..

Discussion in 'JavaScript' started by windy417, Jul 21, 2006.

  1. #1
    Dear all,

    i have the follwoing script, how can i set the startBillDate from 25-06-2005 to Tue June 25 15:34:30 UTC + 0800 2006? because wheni run this script, i can't get the 25-06-2005 but get the different date which is 6 Feb 2007.

    var j = new Date(startBillDate.value);

    alert("j:"+ j);

    var jvalue = j.getDate() + "-" + (parseInt(j.getMonth()) + 1) + "-" + j.getFullYear();

    alert("StartBillDate:"+ jvalue);


    ppcDate.value = adddays(jvalue, 60);


    alert("ppcDate:" + ppcDate.value);

    alert("StartBillDate:" + startBillDate.value);

    if(!checkDateRange( startBillDate, ppcDate,"Start Charging From Date must be equal or greater than project member PPC Date <= 60 days." ))
    {
    return false;
    }


    Any help would be highly appreciated.

    thanks in advance..
     
    windy417, Jul 21, 2006 IP
  2. giraph

    giraph Guest

    Messages:
    484
    Likes Received:
    27
    Best Answers:
    0
    Trophy Points:
    0
    #2
    I'm not sure exactly what you're asking but this is how you set the date to 25-06-2005.
    
    var j = new Date();
    j.setFullYear(2005,5,25);
    
    Code (markup):
     
    giraph, Jul 21, 2006 IP