Created
February 11, 2016 16:30
-
-
Save srkama/e54e525c947f64625422 to your computer and use it in GitHub Desktop.
function to get the day as string for given date in string, expexted format is MM/DD/YYYY
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function findDay(myDate) { | |
| var dayStrArray = ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'] | |
| var pattern = /(\d{2})\/(\d{2})\/(\d{4})/; | |
| var dt = new Date(myDate.replace(pattern,'$3-$1-$2')); | |
| console.log(dayStrArray[dt.getDay()]); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment