I have a date that is in a form that is retrieved from the database and I need to check the date and see if it is more than 6 months old and if it is, make the row red. However the only way I can get it to work is if I use "innerHTML" and hardcode the date. I'm trying to find the code that will recognize it as a date value and not a string.
This is what works as a string if it's hardcoded:
I have also tried the following to get the date to compare and it doesn't work. Here is that code:
Thanks.
This is what works as a string if it's hardcoded:
Code:
for (var i=0, row; row = dataRows[i]; i++) {
var children = row.childNodes;
for (var j = 0; j < grid.columns.length ; j++) {
if (grid.columns[j].id == 'rm_coords.date_updated' && children[j].innerHTML < '11/18/2008') {
I have also tried the following to get the date to compare and it doesn't work. Here is that code:
Code:
var myDate = new Date();
myDate.setDate(myDate.getDate()-180);
var myNewDate = myDate.getMonth()+"|"+myDate.getDate()+"|"+myDate.getYear()
for (var i=0, row; row = dataRows[i]; i++) {
var children = row.childNodes;
for (var j = 0; j < grid.columns.length ; j++) {
if (grid.columns[j].id == 'rm_coords.date_updated' && children[j].nodeValue < myNewDate) {
Thanks.