I want to check given date1 is Today or not
I used
After that, I want to check, given date1 is Today or Yesterday or The day before yesterday. I used <= operator, but its not working properly.
After searching I come up with this solution, before comparing date we need to parse it.
Solution is:
I used
var date2 =get_today();It works successfully.
var result = (date1 == date2);
After that, I want to check, given date1 is Today or Yesterday or The day before yesterday. I used <= operator, but its not working properly.
After searching I come up with this solution, before comparing date we need to parse it.
Solution is:
var a = Date.parse(dataContext.ETD);
var b = Date.parse(get_today());var d = (a - b)/(1000 * 3600 * 24);var c = ((d==0)||(d==(-1))||(d==(-2))); //returns true if ETD is today, yesterday or the day before yesterday
Please write comment if you have any doubt or suggestion.
It works! I had the same problem ...this is a great solution! Thanks!
ReplyDeleteWelcome @CodigoBinarioWeb :)
ReplyDelete