javascript - Is it possible for a regex to know whether a date is a weekend or not? -


To use Javascript, a form field with date needs to be validated: date 21/04/2010 Should be a weekday. Is it possible to make a regular expression for this or is there a better way to do this?

Regex is clearly the wrong tool:

  Var d = new date (); Var parts = dateStr.split ("/"); // Date of date is 0-indexed Var d = new date (part [2], part [1] - 1, part [0]); Var day = d.getDay (); If (days == 0 = days == 6) {// weekend}  

Comments

Popular posts from this blog

Eclipse CDT variable colors in editor -

AJAX doesn't send POST query -

wpf - Custom Message Box Advice -