Shane Partridge
Visual Basic 2013
Initial Runtime Procedure
Handles MyBase.Load
Sub Routine - Handles MyBase.Load
Initial Date Formatting Parameters
Partridge Genealogy : Battle of Pinkie Cleugh 1547
Basic Examples
Battle of Pinkie Cleugh (Rough Wooing)
Commence Date Format = 10 Sep 1547
Current Date Format = 19 May 2019
Calculated Days since Battle = 172281
Calculated Years = 472
Public Class Form1
'## Initial Date to Current Date Formatting Calculus - RunTime Handles MyBase.Load ##
Dim DateDifference As Double
Dim CountTotalDays As Double
Dim CalculateYears As Double
Private Sub InitialRuntimeDate_Load(sender As Object, e As EventArgs) Handles MyBase.Load
'## Initial Date Formatting Parameters (Pinkie Cleugh) ------------- ##
Dim InitialDate As Date = #9/10/1547# '## Note mmddyy ##
Dim LabelInitialDate As String = InitialDate.ToString("dd MMM yyyy")
Label2.Text = LabelInitialDate
'## ------------------------------------------------------------- ##
'## Current Date Formatting Parameters --------------------------- ##
Dim CurrentDate As Date = Date.Now()
Dim LabelCurrentDate As String = CurrentDate.ToString("dd MM yyyy")
Label1.Text = LabelCurrentDate
'## ------------------------------------------------------------- ##
'## Date Calculus and Formatting Parameters ---------------------- ##
DateDifference = DateDiff(DateInterval.Day, InitialDate, CurrentDate)
CountTotalDays = Math.Abs(DateDifference * 1)
CalculateYears = (CountTotalDays / 365)
Label3.Text = CalculateYears.ToString("n2")
Label4.Text = CountTotalDays
'## ------------------------------------------------------------ ##
End Sub
End Class