Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Array Please help

Status
Not open for further replies.

zishan876

Programmer
Joined
Mar 19, 2007
Messages
61
Location
US
Hi all:
I found this great function:
Code:
<script type="text/javascript">

Date.prototype.toJSDate = function() {return ((this.getMonth() + 1 < 10) ? "0" + (this.getMonth() + 1) : (this.getMonth() + 1)) + "/" + ((this.getDate() < 10) ? "0" + this.getDate() : this.getDate()) + "/" + String(this.getFullYear()).substr(2, 2) ;};

function convertDate(obj) {
   var dte = new Date(obj.value);
   obj.value = dte.toJSDate();
}

</script>

Now I have an array which holds dates that are selected, it is in javascript.
The issue is I have to format each value in the array to regular date...

I have been trying this:
Code:
z_cal.prototype.submitSelections = function (returnToDefaultMonth) 
//PRIVATE: submit the calendar's selection variables  
{ 

alert(convertDate(this.selectedDates));
};
The alert box keeps bringing up undefined???
Can someone tell me what m I doing wrong????
PS this.selectedDates is my array of what the user have selected off the calendar. It brings the dates up this way
Thu Mar 29 00:00:00 EDT 2007,Fri Mar 30 00:00:00 EDT 2007
Thanks
Zishan




 
I figured it out...
my new code is
Code:
z_cal.prototype.submitSelections = function (returnToDefaultMonth) 
//PRIVATE: submit the calendar's selection variables  
{ 
for(var i=0; i<this.selectedDates.length; i++)
    alert(this.selectedDates[i].toJSDate());

};
thanks
z
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top