Sub AppStart (Form1 As Form, Args() As String)
MainForm = Form1
MainForm.RootPane.LoadLayout("Layout1")
'MainForm.Show
Dim t As Long = DateTime.DateParse("09/18/2023") + DateTime.TicksPerDay
Log($"$Date{t}: Week #${GetWeekNumberStartingFromMonday(t)}, Day: ${getNumberDate(t)}"$)
End Sub
Sub GetWeekNumberStartingFromMonday (ticks As Long) As Int
Dim WeekDayOfFirstDayOfYear As Int = DateTime.GetDayOfWeek(DateUtils.SetDate(DateTime.GetYear(ticks), 1, 1)) - 1
Dim FirstMondayInYear As Int = (7 + WeekDayOfFirstDayOfYear - 1) Mod 7
Dim result As Int
If WeekDayOfFirstDayOfYear <> 1 Then result = result - 1
result = result + Floor((DateTime.GetDayOfYear(ticks) - 1 + FirstMondayInYear) / 7) + 1
Return result
End Sub
Sub getNumberDate (datet As Long) As Int
DateTime.DateFormat = "yyyy/MM/dd"
Dim yr As Int = DateTime.GetYear(DateTime.Now)
Dim p As Period = DateUtils.PeriodBetweenInDays(DateTime.DateParse($"${yr}/01/01"$), datet)
Return p.Days
End Sub