| |

VerySource

 Forgot password?
 Register
Search
Author: lzcmaomao

Find a piece of VB source code, use call to call, find the year of 2010 to 2050

[Copy link]

0

Threads

2

Posts

3.00

Credits

Newbie

Rank: 1

Credits
3.00

 China

Post time: 2020-6-1 01:30:01
| Show all posts
Private Sub Command1_Click ()
Dim i As Integer
Dim datTemp As Date

    For i = 2010 To 2050
        datTemp = GetLastDate_Month (DateSerial (i, 2, 1))
        If Day (datTemp) = 29 Then
            Debug.Print i
        End If
    Next i
End Sub

Private Function GetLastDate_Month (ByVal datDate As Date) As Date
    GetLastDate_Month = DateAdd ("d", -Day (DateAdd ("m", 1, datDate)), DateAdd ("m", 1, datDate))
End Function
Reply

Use magic Report

0

Threads

14

Posts

6.00

Credits

Newbie

Rank: 1

Credits
6.00

 Reunion

Post time: 2020-7-15 09:30:01
| Show all posts
Private Sub Command1_Click()
Dim i As Integer
With CreateObject("scripting.dictionary")
For i = 2010 To 2050
If Day(DateSerial(i, 3, 0)) = 29 Then .Add i, Nothing
Next
MsgBox Join(.keys, vbCrLf)
End With
End Sub
Reply

Use magic Report

You have to log in before you can reply Login | Register

Points Rules

Contact us|Archive|Mobile|CopyRight © 2008-2023|verysource.com ( 京ICP备17048824号-1 )

Quick Reply To Top Return to the list