Ever wonder how old that opportunity it is. Here's some script that will display a the age of an opportunity when you open it.

Make sure you put the createdon attribute on the form somewhere( admin tab seems the place).

Put the script in the OnLoad

 

var createdon= crmForm.all.createdon.DataValue;

var today = new Date();

 

//Set the two dates

today=new Date();

 

//Set 1 day in milliseconds

var one_day=1000*60*60*24;

 

//Calculate difference btw the two dates, and convert to days

var Age = Math.ceil((today.getTime()-createdon.getTime())/(one_day));

 

// Display Age

alert("Opportunity Age in Days : " + Age);

-cheers
Jon