'Log____________
'1995-05-10 is Northern Spring (Planting time)
'2024-06-24 is Northern Summer (Midsummer Day)
'1946-10-02 is Northern Autumn (Fall colors and a special day)
'1975-02-12 is Northern Winter (Canada in February - Brrr)
'2024-12-25 is Northern Winter (it is a White Christmas here)
'2024-12-20 is Northern Autumn (tomorrow is Winter Solstace)
Private Sub B4XPage_Created (Root1 As B4XView)
Root = Root1
DateTime.DateFormat = "yyyy-MM-dd"
Dim sampleDates() As String = Array As String("1995-05-10", "2024-06-24", "1946-10-02", "1975-02-12", "2024-12-25", DateTime.Date(DateTime.Now))
For i = 0 To sampleDates.Length - 1
Select True
Case inDateRange(sampleDates(i), "*-01-01", "*-03-19")
Log(sampleDates(i) & " is Northern Winter")
Case inDateRange(sampleDates(i), "*-03-20", "*-06-20")
Log(sampleDates(i) & " is Northern Spring")
Case inDateRange(sampleDates(i), "*-06-21", "*-09-21")
Log(sampleDates(i) & " is Northern Summer")
Case inDateRange(sampleDates(i), "*-09-22", "*-12-20")
Log(sampleDates(i) & " is Northern Autumn")
Case inDateRange(sampleDates(i), "*-12-21", "*-12-31")
Log(sampleDates(i) & " is Northern Winter")
End Select
Next
End Sub
Private Sub inDateRange(dt As String, fromDt As String, toDt As String) As Boolean
Dim dtLong As Long = DateTime.DateParse(dt)
Dim year As String = DateTime.GetYear(dtLong)
Dim minIclDate As Long = DateTime.DateParse(fromDt.Replace("*", year))
Dim maxIclDate As Long = DateTime.DateParse(toDt.Replace("*", year))
Return dtLong >= minIclDate And dtLong <= maxIclDate
End Sub