validation - javascript validate date in the past -


I want to compare if a given date is in the past or in the future.
The date given is coming from one string in Yyyy-mm-dd format.
Today I have tried to "out" today and I have compensated in the time of date dated but I am sure that there should be a better way for this ??

  var today = new date (); Console.log ("Today:" + today); // Mon Apr 28 2014 14:46:41 GMT + 0200 (CETT) Today Virgin = Today. Jellyfish (); Today's monsoon today = today.gate (); Today's Monso = Persients (Today's Month, 10) + 1; Today is daydays = today.GetDate (); Today today, Firmated = Nowadays + "-" + Today's Silence + "- today + today; today = new date (formatted today); Console.log (" Today: "+ Today); // Mon Apr 28 2014 00:00 : 00 GMT + 0200 (CEST) var testDate = new date ("2014-04-28"); Console.log ("test:" + testDate); // Mon Apr 28 2014 02:00 GMT + 0200 ( CST) testDate.setHours (00); Console.log ("test:" + testDate); // Check whether the test is in the past (testDate today)? Console.log ('test is in the past'): Console.log ('test is not in the past');  

You "Unix Times "Mathematically you Can not:

  var today = new date (); Console.log (testDate.getTime () & lt; today.getTime ()? 'Testing is in the past': 'Exam is not in the past');  

Comments

Popular posts from this blog

import - Python ImportError: No module named wmi -

Editing Python Class in Shell and SQLAlchemy -

c# - MySQL Parameterized Select Query joining tables issue -