Advertisement
Guest User

Untitled

a guest
Oct 16th, 2019
101
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.64 KB | None | 0 0
  1. function monthWeeks(year, month) {
  2.  
  3. var days = ['Domingo', 'Lunes', 'Martes', 'Miércoles', 'Jueves', 'Viernes', 'Sábado'];
  4. var months = ['Enero', 'Febrero', 'Marzo', 'Abril', 'Mayo', 'Junio', 'Julio', 'Agosto', 'Septiembre', 'Octubre', 'Noviembre', 'Diciembre'];
  5. var firstDay = new Date(year, month, 1);
  6. var totalDays = new Date(year, month, 0).getDate();
  7. var tueofMonth = 0
  8. for (var i = 1; i <= totalDays; i++) {
  9. var weekDay = new Date(year, month, i);
  10. //console.log("Día "+i+" de "+months[month]+" es: "+ days[weekDay.getDay()]);
  11. if (weekDay.getDay() == 2) {
  12. tueofMonth++;
  13. if (tueofMonth == 3) {
  14. break;
  15. }
  16. }
  17. }
  18. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement