I have following script that tells me how many live days I have been travelling. But I would like it to display in the following format
YEARS/MONTHS/DAYS
As in display "
Dave has been travelling for 4 years 3 months 12 days"
The current script only tells me how many days I have been travelling
Could anyone help me here please?
<script>
/*
Count up from any date script-
By JavaScript Kit (
www.javascriptkit.com)
Over 200+ free scripts here!
*/
var montharray=new Array("Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec")
function countup(yr,m,d){
var today=new Date()
var todayy=today.getYear()
if (todayy < 1000)
todayy+=1900
var todaym=today.getMonth()
var todayd=today.getDate()
var todaystring=montharray[todaym]+" "+todayd+", "+todayy
var paststring=montharray[m-1]+" "+d+", "+yr
var difference=(Math.round((Date.parse(todaystring)-Date.parse(paststring))/(24*60*60*1000))*1)
difference+=" days"
document.write("It\'s been "+difference+" since Dave has been travelling!")
}
//enter the count up date using the format year/month/day
countup(2005,01,05)
</script>
<p align="center"><font face="arial" size="-2">This free script provided by</font><br>
<font face="arial, helvetica" size="-2"><a href="http://javascriptkit.com">JavaScript
Kit</a></font></p>