Subject |
Re: time calculations |
From |
Gaetano <gaetanodd@hotmail.com> |
Date |
Sat, 14 Nov 2020 22:37:53 +1000 |
Newsgroups |
dbase.getting-started |
You are using date() and that does not include time data, you need to
use datetime() if you want both date and time info.
Then to calculate the difference in minutes, you need to get the date
values into a variable.
So in your below code, the pushbutton PB1 that populates ef1 needs to
store the datetime() value to a variable dt1 in addition to storing it
to ef1, and PB2 that populates ef2 would store the check out time to ef2
and to the variable dt2, and can also update the ef3 field:
PB1_onclick()
form.dt1=datetime()
form.ef1.value=form.dt1
PB2_onclick()
form.dt2=datetime()
form.ef2.value=form.dt2
form.ef3.value=int( (form.dt2-form.dt1)*1440 )
return
Using a form property instead of the entryfield value is perhaps not
ideal, but this is just to illustrate time calculation logic using a
datetime value.
Cheers,
Gaetano.
On 14/11/2020 15:50, Moses Hanna wrote:
> I am quoting down under a form image
> I am trying to calculate duration time in minutes for the last two days
> i am trying but unsuccessful
> I practiced programing long time ago
> now I have forgotten many many thing
> now I need help
> how to fill ef3 of the form with number of duration time in minutes
> any help please
>
> ** END HEADER -- do not remove this line
> //
> // Generated on 14/11/2020
> //
> parameter bModal
> local f
> f = new UntitledForm()
> if (bModal)
> f.mdi = false // ensure not MDI
> f.readModal()
> else
> f.open()
> endif
>
> class UntitledForm of FORM
> set procedure to time.cc additive
> with (this)
> height = 9.5455
> left = 124.4286
> top = 4.4091
> width = 48.5714
> text = ""
> endwith
>
> this.PB1 = new PUSHBUTTON(this)
> with (this.PB1)
> onClick = {;form.ef1.value = date()}
> height = 1.0909
> left = 5.0
> top = 2.1818
> width = 15.2857
> text = "Client In"
> endwith
>
> this.TIME1EF = new ENTRYFIELD(this)
> with (this.TIME1EF)
> height = 1.0
> left = 22.0
> top = 2.1818
> width = 12.0
> value = ""
> endwith
>
> this.PB2 = new PUSHBUTTON(this)
> with (this.PB2)
> onClick = {;form.ef2.value = date()}
> height = 1.0909
> left = 5.0
> top = 4.5455
> width = 15.2857
> text = "Client Out"
> endwith
>
> this.TIME2EF = new ENTRYFIELD(this)
> with (this.TIME2EF)
> height = 1.0
> left = 22.0
> top = 4.5455
> width = 12.0
> value = ""
> endwith
>
> this.TEXT1 = new TEXT(this)
> with (this.TEXT1)
> height = 1.0
> left = 5.0
> top = 6.3636
> width = 15.0
> text = "Duration In"
> endwith
>
> this.DURATIONEF = new ENTRYFIELD(this)
> with (this.DURATIONEF)
> height = 1.0909
> left = 22.0
> top = 6.0
> width = 12.0
> value = ""
> endwith
>
>
> endclass
>
|
|