[Asp.net]取日期函數(含閏年)12/8

  Function leap(ByVal ym As String)
        Dim yy, mm, dd, ydate As String
        yy = Left(ym, 4)
        mm = Right(ym, 2)
        Select Case mm
            Case "01", "03", "05", "07", "08", "10", "12"
                dd = "31"
            Case "04", "06", "09", "11"
                dd = "30"
            Case Else
                If yy Mod 4 = 0 Or yy Mod 400 = 0 Then
                    dd = "29"
                Else
                    dd = "28"
                End If

        End Select
        ydate = yy + "-" + mm + "-" + dd
        Return ydate
    End Function

你可能感兴趣的:(asp.net)