'求某月天數
Function 本月天數(日期 As Date) As Byte
本月天數 = DateSerial(Year(日期), Month(日期) + 1, Day(日期)) - 日期
End Function
'求月末日期
Function 月末(日期 As Date) As Date
月末 = DateSerial(Year(日期), Month(日期) + 1, 0)
End Function
'求月初日期
Function 月初(日期 As Date) As Date
月初 = 日期 - Day(日期) + 1
End Function
Function 月初(日期 As Date) As Date
月初 = CDate(FORMat(日期, "yyyy-m-1"))
End Function
自定義結帳日的歸屬月份函數。即本月25日前算本月,26日后歸入下個月。
Function 結帳月(日期 As Date, 結帳日 As Byte)
結帳月 = Format(DateSerial(Year(日期), Month(日期 - 結帳日) + 1, 1), "yy-mm")
End Function
編輯:北京信誠IT保姆IT外包部 http:// www.aboverow.cn www.xcit.com.cn |