【ASP】取得年月的最後一天
取得某年某月的最後一天
' Returns the last day of the month. Takes into account leap years
' Usage: LastDay(Month, Year)
Function LastDay(MyMonth, MyYear)
'MyYear用民國年算法
'LastDay=day(dateserial(MyYear+1911,MyMonth+1,0))
'MyYear用西元年算法
LastDay=day(dateserial(MyYear,MyMonth+1,0))
'以上紅色字...2擇一
End Function
Ex:2018年11月的最後一天
Response.Write LastDay(11,2018) =>30
Ex:2018年2月的最後一天
Response.Write LastDay(2,2018) =>28
留言
張貼留言