2014-02-19 6 views
0

그래서 내가 가지고있는 유일한 가치는 그 달입니다. 예를 들어 2 월 1 일에 대한 요일이 1이고 두 번째 요일이 2 - 8이라는 것을 어떻게 알 수 있습니까?그 달의주의 날짜를 가져 오는 방법이 있습니까?

보고서 생성에이 도구를 사용하고 있으며 주간 보고서도 있어야합니다. 이 보고서를 가져 오는 또 다른 방법을 알려주시겠습니까?

이 시스템에서는 고전적인 asp 및 javascript를 사용하고 있습니다.

+0

당신이 [자바 스크립트 태그를] 원하는 있습니까 사용하려면? – Lankymart

답변

0

도서관 Moment.js이 도움이 될 것입니다.

달의 일 수를 가져옵니다. 이 방법은 6 0과 토요일 일요일로 요일을 설정하는 데 사용할 수 있습니다

moment("2012-02", "YYYY-MM").daysInMonth() // 29 
moment("2012-01", "YYYY-MM").daysInMonth() // 31 

(http://momentjs.com/docs/#/displaying/days-in-month) :

moment().day(Number|String); 
moment().day(); // Number 
moment().days(Number|String); 
moment().days(); // Number 

(http://momentjs.com/docs/#/get-set/day/)

0

잠시 동안 주변에 있었던 잘 사용 된 솔루션입니다. 또는 [태그 : ASP에서 고전] 솔루션 :

<% 
' Copyright (c) 2008, reusablecode.blogspot.com; some rights reserved. 
' 
' This work is licensed under the Creative Commons Attribution License. To view 
' a copy of this license, visit http://creativecommons.org/licenses/by/3.0/ or 
' send a letter to Creative Commons, 559 Nathan Abbott Way, Stanford, California 
' 94305, USA. 

' Check if a year is a leap year. 
function isLeapYear(someYear) 
    if someYear Mod 4 = 0 and (someYear Mod 100 <> 0 or (someYear Mod 100 = 0 and someYear Mod 400 = 0)) then 
     isLeapYear = True 
    else 
     isLeapYear = False 
    end if 
end function 

' Returns the number of days in a given month (and in the case of February, for the given year). 
' REQUIRES: isLeapYear() 
function MonthDays(someMonth, someYear) 
    select case someMonth 
    case 1, 3, 5, 7, 8, 10, 12 
     MonthDays = 31 
    case 4, 6, 9, 11 
     MonthDays = 30 
    case 2 
     if isLeapYear(someYear) then 
      MonthDays = 29 
     else 
      MonthDays = 28 
     end if 
    end select 
end function 
%> 

<% 
Dim daysinmonth 
'Number if days in January 2014 
daysinmonth = MonthDays(1, 2014) 
%> 
관련 문제