G
Gary Simpson
Guest
Hi Good People
Can You help me I can Write Code for Days, Hours, Minutes, Seconds Using the word Difference As in the Code Below.
TextBox4.Text = FormatNumber(Difference.TotalDays, 0)
TextBox5.Text = FormatNumber(Difference.TotalHours, 0)
TextBox6.Text = FormatNumber(Difference.TotalMinutes, 0)
TextBox7.Text = FormatNumber(Difference.TotalSeconds, 0)
But I cannot use the same code for Years, Months, Weeks. Is there another type of coding to get the Total Years, Months, Weeks That have past between two Date I select from 2 DateTimePickers. The code I have at the moment is below. Where I am having problems is the code for TextBox1 to Textbox3, Can Someone please point me in the right Direction.
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
Timer1.Start()
Dim Date1 As Date
Dim Date2 As Date
Dim Difference As TimeSpan
Dim DayOne As FirstDayOfWeek = DateTimePicker1.Value
Date1 = Convert.ToDateTime(DateTimePicker1.Value)
Date2 = Convert.ToDateTime(DateTimePicker2.Value)
Difference = Date2.Subtract(Date1)
'TextBox1.Text = FormatNumber(Difference.TotalYears, 0) '0 is for Decimal Places
'TextBox2.Text = FormatNumber(Difference.TotalMonths, 0) '0 is for Decimal Places
'TextBox3.Text = FormatNumber(Difference.Weeks, 0) '0 is for Decimal Places
TextBox4.Text = FormatNumber(Difference.TotalDays, 0)
TextBox5.Text = FormatNumber(Difference.TotalHours, 0)
TextBox6.Text = FormatNumber(Difference.TotalMinutes, 0)
TextBox7.Text = FormatNumber(Difference.TotalSeconds, 0)
End Sub
Gary Simpson
Continue reading...
Can You help me I can Write Code for Days, Hours, Minutes, Seconds Using the word Difference As in the Code Below.
TextBox4.Text = FormatNumber(Difference.TotalDays, 0)
TextBox5.Text = FormatNumber(Difference.TotalHours, 0)
TextBox6.Text = FormatNumber(Difference.TotalMinutes, 0)
TextBox7.Text = FormatNumber(Difference.TotalSeconds, 0)
But I cannot use the same code for Years, Months, Weeks. Is there another type of coding to get the Total Years, Months, Weeks That have past between two Date I select from 2 DateTimePickers. The code I have at the moment is below. Where I am having problems is the code for TextBox1 to Textbox3, Can Someone please point me in the right Direction.
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
Timer1.Start()
Dim Date1 As Date
Dim Date2 As Date
Dim Difference As TimeSpan
Dim DayOne As FirstDayOfWeek = DateTimePicker1.Value
Date1 = Convert.ToDateTime(DateTimePicker1.Value)
Date2 = Convert.ToDateTime(DateTimePicker2.Value)
Difference = Date2.Subtract(Date1)
'TextBox1.Text = FormatNumber(Difference.TotalYears, 0) '0 is for Decimal Places
'TextBox2.Text = FormatNumber(Difference.TotalMonths, 0) '0 is for Decimal Places
'TextBox3.Text = FormatNumber(Difference.Weeks, 0) '0 is for Decimal Places
TextBox4.Text = FormatNumber(Difference.TotalDays, 0)
TextBox5.Text = FormatNumber(Difference.TotalHours, 0)
TextBox6.Text = FormatNumber(Difference.TotalMinutes, 0)
TextBox7.Text = FormatNumber(Difference.TotalSeconds, 0)
End Sub
Gary Simpson
Continue reading...