Welcome to collectivesolver - Programming & Software Q&A with code examples. A website with trusted programming answers. All programs are tested and work.

Contact: aviboots(AT)netvision.net.il

Semrush - keyword research tool

Turn ChatGPT, Claude, Gemini, And CoPilot Into Your Personal Assistant, Business Coach, Content Creator, And More

AFFILIATE MARKETING Your all-in-one performance engine Manage affiliates, creators, and customer referrals in one unified platform—turning every partnership into measurable growth
Secure & Reliable Web Hosting, Free Domain, Free SSL, 1-Click WordPress Install, Expert 24/7 Support

Boost your online presence with premium web hosting and servers

Disclosure: My content contains affiliate links.

42,638 questions

55,373 answers

573 users

How to calculate the future occurrences of Friday the 13th in VB.NET

1 Answer

0 votes
Imports System

Class FridayThe13ths
    Private Shared Sub FindFridayThe13ths(ByVal startYear As Integer, ByVal endYear As Integer)
        For year As Integer = startYear To endYear

            For month As Integer = 1 To 12
				Dim dt As DateTime = New DateTime(year, month, 13)

				If dt.DayOfWeek = DayOfWeek.Friday Then
                    Console.WriteLine($"Friday the 13th: {year}-{month}-13")
                End If
            Next
        Next
    End Sub

    Public Shared Sub Main()
        FindFridayThe13ths(2025, 2031)
    End Sub
End Class


 
' run
'
' Friday the 13th: 2025-6-13
' Friday the 13th: 2026-2-13
' Friday the 13th: 2026-3-13
' Friday the 13th: 2026-11-13
' Friday the 13th: 2027-8-13
' Friday the 13th: 2028-10-13
' Friday the 13th: 2029-4-13
' Friday the 13th: 2029-7-13
' Friday the 13th: 2030-9-13
' Friday the 13th: 2030-12-13
' Friday the 13th: 2031-6-13
'

 



answered May 31, 2025 by avibootz
...