Created
February 6, 2014 16:59
-
-
Save LESTADru/8848263 to your computer and use it in GitHub Desktop.
функцию, getLocalDay(date) которая возвращает день недели для даты date.
This file contains 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
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="UTF-8"> | |
<title>функцию, getLocalDay(date) которая возвращает день недели для даты date.</title> | |
</head> | |
<body> | |
<script> | |
"use strict"; | |
function getLocalDay(date){ | |
var dayOfWeek = date.getDay(); | |
return (dayOfWeek == 0)?7:dayOfWeek; | |
} | |
var date = new Date(2012, 0, 3); // 3 янв 2012 | |
alert( getLocalDay(date) ); // вторник, выведет 2 | |
</script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment