Check the dates in JavaScript -


I want to see two dates in java script. The date format is YYYY-MM-dd.

  var date1 = 2011-9-2; Var date1 = 2011-17-06;   

Can someone say how I can write the condition?

If you mean you want to compare them and your variable is string, just for comparison Use ==.

  var date1 = '1990-26-01'; Var date2 = '2000-01-05'; If (date1 == date2) {warning ('date1 = date2')} other {warning ('something went wrong'); }    

Comments

Popular posts from this blog

mysql - BLOB/TEXT column 'value' used in key specification without a key length -

c# - Using Vici cool Storage with monodroid -

python - referencing a variable in another function? -