vbs obtiene la fecha del primer y último día del mes

Dim TargetDate, StrYear, StrMonth, StrDay
 Dim StartDate, Strtime 

TargetDate = Date 
' 获取 年月 日 
StrYear = Year (TargetDate) 
StrMonth = Month (TargetDate)
 If  Len (strMonth) < 2  Then 
StrMonth = " 0 " & StrMonth
 End  If 
StrDay = " 01 " 
' 开始 日期 
StartDate = StrYear & StrMonth & StrDay
 ' 结束 日期 
Strtime = DateSerial (Year (Now), Month (Now) + 1 , 1 - 1 )
 If  len ( month (Strtime)) < 2  Then 
StrMonth = " 0 " & month (Strtime)
 Termina  si 
LastDate = Year (Strtime) & StrMonth & day ( Strtime)
 MsgBox StartDate & " | " & LastDate

 

Supongo que te gusta

Origin www.cnblogs.com/lnd-blog/p/12674873.html
Recomendado
Clasificación