Shane Partridge
Visual Basic 2013
The Code
Public Class Form1
'## Initial Date Calculus 11 Sep 2001 ##
'## ODA 595 - Code Name : Jaw Breaker ##
'## Operational Detachment Alpha's - ODA-595 ##
'## Rashid Dostum Northern Alliance against ISIS ##
Dim CurrentDate As String '# Value added from TextBox1 #
Dim InitialDate As Date ' # Date CDate Calculus #
Dim Currdate As Date '# Date CDate Calculus #
Dim DTD As Double
Dim Cnt As Single
Dim Format = "dd MMM yyyy" '### Note Capital dd MMM yyyy ###
Dim DecimalPlace = "n3" '### DecimalPlace = 3 ###
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
'## Sub Routine ##
'## Sub Routine (1) ##
InputCurrentDate()
'## Sub Routine (2) ##
InitiateDateNumber()
'## Sub Routine (3) ##
CalculateDateNumber()
End Sub
'## Sub(1) ##
Sub InputCurrentDate()
Label1.Text = TextBox1.Text
End Sub
'## Sub(2) ##
Sub InitiateDateNumber()
Dim CuDate As Date = #9/11/2001#
Dim FormatDate As String = CuDate.ToString(Format)
Label1.Text = FormatDate
InitialDate = CDate(FormatDate)
CurrentDate = TextBox1.Text
Currdate = CDate(CurrentDate)
End Sub
'## Sub(3) ##
Sub CalculateDateNumber()
DTD = DateDiff(DateInterval.Day, InitialDate, Currdate)
Cnt = Math.Abs(DTD * 1)
Label2.Text = Cnt
Label3.Text = (Cnt / 365).ToString(DecimalPlace)
End Sub
Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
'## Clear Text & Label Boxes ##
TextBox1.Text = ""
Label1.Text = ""
Label2.Text = ""
Label3.Text = ""
End Sub
Private Sub Button3_Click(sender As Object, e As EventArgs) Handles Button3.Click
'## Initiate Close Forms
Close()
End Sub
End Class