D deyan666 Member Licensed User Longtime User Jul 7, 2015 #1 hey guys so im trying to calculate the difference in two times. A sign on and a sign off. Im using this formula and it works but not entirely the way i want: Dim rsoff As Long = DateTime.TimeParse(EditText3.Text) Dim asoff As Long = DateTime.TimeParse(EditText4.Text) EditText6.Text = DateUtils.PeriodBetween(rsoff, rson) question 1: how do i get the result of the difference to be a time. and not years = - months = 0 days = 0 hours = 8 min = 0 etc etc question 2: sometimes ill sign on friday night and finish saturday morning. how can i code that to have the friday portion as one variable and saturday portion as another? been working on this about 6 months still cant get it right
hey guys so im trying to calculate the difference in two times. A sign on and a sign off. Im using this formula and it works but not entirely the way i want: Dim rsoff As Long = DateTime.TimeParse(EditText3.Text) Dim asoff As Long = DateTime.TimeParse(EditText4.Text) EditText6.Text = DateUtils.PeriodBetween(rsoff, rson) question 1: how do i get the result of the difference to be a time. and not years = - months = 0 days = 0 hours = 8 min = 0 etc etc question 2: sometimes ill sign on friday night and finish saturday morning. how can i code that to have the friday portion as one variable and saturday portion as another? been working on this about 6 months still cant get it right
Erel B4X founder Staff member Licensed User Longtime User Jul 7, 2015 #2 Use PeriodBetweenInDays if you are not interested in years and months. If you know that the total time is less than a full day then you can use the code I posted here to convert it to a "time" string: https://www.b4x.com/android/forum/threads/convert-dateperiod-to-string.51046/#post-319385 A2: You need to make two calculations. One from the beginning time till 00:00 the next day and another calculation from 00:00 to the end time. Upvote 0
Use PeriodBetweenInDays if you are not interested in years and months. If you know that the total time is less than a full day then you can use the code I posted here to convert it to a "time" string: https://www.b4x.com/android/forum/threads/convert-dateperiod-to-string.51046/#post-319385 A2: You need to make two calculations. One from the beginning time till 00:00 the next day and another calculation from 00:00 to the end time.
D deyan666 Member Licensed User Longtime User Jul 7, 2015 #3 Erel said: Use PeriodBetweenInDays if you are not interested in years and months. If you know that the total time is less than a full day then you can use the code I posted here to convert it to a "time" string: https://www.b4x.com/android/forum/threads/convert-dateperiod-to-string.51046/#post-319385 A2: You need to make two calculations. One from the beginning time till 00:00 the next day and another calculation from 00:00 to the end time. Click to expand... Thanks Erel ill give it a shot! Upvote 0
Erel said: Use PeriodBetweenInDays if you are not interested in years and months. If you know that the total time is less than a full day then you can use the code I posted here to convert it to a "time" string: https://www.b4x.com/android/forum/threads/convert-dateperiod-to-string.51046/#post-319385 A2: You need to make two calculations. One from the beginning time till 00:00 the next day and another calculation from 00:00 to the end time. Click to expand... Thanks Erel ill give it a shot!