I've got the following script inside a text field.calcualte
I have two fields:
1st Today's Date (calculated field, read only) "Today"
2nd DOB date picker "DOB"
3rd Age Text Field "Age"
this is the script I have in "Age"
// define some time constants
var fSec = 1000; //second
var fMin = 60 * fSec; // minute
var fHr = 60 * fMin; // hour
var fDay = 24 * fHr; // day
var fYear = 365.25 * fDay; // year
var strStart = this.getField("DOB").value; // dob
//var strToday = util.printd("mmm dd, yyyy", new Date()); // get system date time
var strToday = this.getField("Today").value;
// compute if there are values for dob and today
if(strStart.length & strToday.length) {
var dob = util.scand("mmm d, yyyy", strStart); // convert dob to date time object
var today = util.scand("mmm d, yyyy", strToday); // convert today to date time object
var diff = today.valueOf() - dob.valueOf(); // compute difference of values
diff = diff + fDay; // adjust to count today as a counted day
event.value = Math.floor(diff/ fYear); // truncate to whole years
}
The code looks good but doesn't produce any results....any help/assistance?