Agggggg!
First of all I'm using php, mysql.
I've got a form that has a text entry and I'm trying to perform date difference calculation. The problem is I get a page error every time I run this line:
<input name="mag_time" type="text" tabindex="15" onChange="this.form.mag_timediff.value = days_between(<?php echo $trenddate->Fields('tddate'); ?>,<?php echo $tddateprevious->Fields('tddate'); ?>);" value="<?php echo htmlentities($param_tx2->Fields('mag_time')); ?>" size="8" maxlength="8">
The error comes up error expected ')' code 0 at char 56. I have two recordsets that return the date-time stamp of two records, these being trenddate and tddateprevious.
The function that I have in my javascript page is:
<!--
function days_between(date1, date2) {
// The number of milliseconds in one day
var ONE_DAY = 1000 * 60 * 60 * 24
// Convert both dates to milliseconds
var date1_ms = date1.getTime()
var date2_ms = date2.getTime()
// Calculate the difference in milliseconds
var difference_ms = Math.abs(date1_ms - date2_ms)
// Convert back to days and return
return Math.round(difference_ms/ONE_DAY)
}
//-->
If I equate the days_between call to days_between(); the error goes away. I'm not sure if the problem is in passing the data parameter in the php code or what
Can some one enlighten me with my error I've made.
Thanks
😕