I am trying to build an if statement on javascript;
if (nextProcessingDate > today ) {
//do something
}
nextProcessingDate is assigned a timestamp, i.e. 09/07/2014 12:10:17
I am using the following code to assign today's timestamp to today variable
/*script start*/
var today = new Date();
var dd = today.getDate();
var mm = today.getMonth() + 1; //January is 0!
var yyyy = today.getFullYear();
var s = today.getSeconds();
var m = today.getMinutes();
var h = today.getHours();
if (dd < 10) {
dd = '0' + dd
}
if (mm < 10) {
mm = '0' + mm
}
if (s < 10) {
s = '0' + s
}
if (m < 10) {
m = '0' + m
}
if (h < 10) {
h = '0' + h
}
today = dd + '/' + mm + '/' + yyyy + ' ' + h + ':' + m + ':' + s;
/*script end*/
Now what I really want to do is "If nextprocessingDate is bigger than today plus One day then do something"
if (nextProcessingDate > (today + 1){
//do something
}
Thanks for your help, here is the fiddle link http://jsfiddle.net/E5vG4/1/
Update So, here is the updated fiddle which seems to work to some extend. http://jsfiddle.net/E5vG4/9/
The issue now is that it only returns true of the processingdate timestamp is equals or over 24hours from now, I need to test it for 09:30am which in this case it returns false.
Would stripping the time from the next processing date fix it somehow?