Created
February 6, 2014 18:14
-
-
Save LESTADru/8849549 to your computer and use it in GitHub Desktop.
функцию getLastDayInMonth(year, month), которая возвращает последний день месяца.
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> функцию getLastDayInMonth(year, month), | |
которая возвращает последний день месяца.</title>use soft Wraps | |
</head> | |
<body> | |
<script> | |
"use strict"; | |
function getLastDayInMonth(year, month){ | |
var date = new Date(year, month+1, 0); | |
return date.getDate(); | |
} | |
alert(getLastDayInMonth(2012, 2)); | |
</script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment