Date.padded2=function(hour){padded2=hour.toString();if((parseInt(hour)<10)||(parseInt(hour)==null))padded2="0"+padded2;return padded2;}
Date.prototype.getAMPMHour=function(){hour=Date.padded2(this.getHours());return(hour==null)?00:(hour>24?hour-24:hour)}
Date.prototype.getAMPM=function(){return"";}
Date.monthsShort=$w("Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec");Date.prototype.toFormattedString=function(include_time){str=Date.padded2(this.getDate())+'-'+Date.monthsShort[this.getMonth()]+'-'+this.getFullYear();if(include_time){str+=" "+this.getAMPMHour()+":"+this.getPaddedMinutes()}
return str;}
Date.parseFormattedString=function(string){var regexp="(([0-3]?[0-9])-[a-z]{3}-[0-9]{4}) *([0-9]{1,2}(:[0-9]{2})?)?";string=string.strip();var d=string.match(new RegExp(regexp,"i"));if(d==null){return Date.parse(string);}
mdy=d[1].split('-');var monthIndex=0;if(Date.monthsShort.include(mdy[1])){for(i=0;i<Date.monthsShort.length;i++){if(mdy[1]==Date.monthsShort[i]){monthIndex=i;break;}}}
hrs=0;mts=0;if(d[3]!=null&&d[3].strip()!=""){hrs=parseInt(d[3].split(':')[0],10);mts=d[4].split(':')[1];}
return new Date(mdy[2],monthIndex,mdy[0],hrs,mts,0);}
