月份前面用on还是in:用“0”填充月份(asp month)

这是我的代码:

If FinalMonth = "" OR FinalYear = ""  Then
    FinalMonth = Month(Now())
    FinalYear = Year(Now())
End If
Select Case(FinalMonth)
    Case "01","03","05","07","08","10","12"
        FinalDay = "31"
    Case "04","06","09","11"
        FinalDay = "30"
    Case "02"
        If ( (FinalYear Mod 4) <> 0 ) Then
            FinalDay = "28"
        Else
            FinalDay = "29"
        End If
End Select

我想在每个例子的数字 1(1 月)之前设置我的月份 0,最后是月份 01。

0

你可以;

If FinalMonth = "" OR FinalYear = ""  Then
    FinalMonth = Month(Now())
    FinalYear = Year(Now())
End If
'get last day of month - add 1 month then deduct 1 day
FinalDay = Day(DateSerial(FinalYear, FinalMonth + 1, 1) - 1)
'pad month
if (FinalMonth < 10) then FinalMonth = "0" & FinalMonth 
0

这个怎么样?

<%=Right("0" & Day(now()), 2)%>-<%=Right("0" & Month(now()), 2)%>-<%=Year(now())%>

输出:10-02-2018

本站系公益性非盈利分享网址,本文来自用户投稿,不代表边看边学立场,如若转载,请注明出处

(60)
制造业行业类别与代码:角模拟场 /属性与茉莉/业力(jasmine field)
下一篇

相关推荐

发表评论

登录 后才能评论

评论列表(26条)