Group:  Microsoft Access ยป microsoft.public.access.formscoding
Thread: Converting Integer to Time Datatype- Possible ?

Geek News

Converting Integer to Time Datatype- Possible ?
"edisonl via AccessMonster.com" <u47544[ at ]uwe> 12/10/2008 4:56:37 AM
Hi,

Got a tricky problem here.. I had 4 Text Box(es) input for Hours & Minutes
Respectively as follows:

StartHours_Text StartMinutes_Text

EndHours_Text EndMinutes_Text
'Both have test statement for right inputs Eg: Hours Between 0-23, Minutes
Only (Mod,15)

Problem arises when I need to some minus operations to find time differences
Eg:
Start Time : 08 Hours 45Minutes
End Time : 10 Hours 15Minutes
__________________________________________________________________
Hours(1Hours) = EndHours_Text -
StartHours_Text
Minutes (30Minutes ~0.5Hours) = EndMinutes_Text - StartMinutes_Text
___________________________________________________________________

End Value: 1.5 (Decimal or ANy Datatype)

--
Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/Forums.aspx/access-formscoding/200812/1

Re: Converting Integer to Time Datatype- Possible ?
"Allen Browne" <AllenBrowne[ at ]SeeSig.Invalid> 12/10/2008 5:09:53 AM
You could calculate the number of minutes like this:
(60 * Nz([EndHours_Text], 0) + Nz([EndMinutes_Text], 0)) -
(60 * Nz([StartHours_Text], 0) + Nz([StartMinutes_Text] ,0))

If you want hours-and-decimial, bracket the whole thing and divide by 60.

Use integer division and Mod for hour:minute format.
Details in 5th paragraph here:
http://allenbrowne.com/casu-13.html

--
Allen Browne - Microsoft MVP. Perth, Western Australia
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

"edisonl via AccessMonster.com" <u47544[ at ]uwe> wrote in message
news:8e6fde253148a[ at ]uwe...
[Quoted Text]
>
> Got a tricky problem here.. I had 4 Text Box(es) input for Hours & Minutes
> Respectively as follows:
>
> StartHours_Text StartMinutes_Text
>
> EndHours_Text EndMinutes_Text
> 'Both have test statement for right inputs Eg: Hours Between 0-23, Minutes
> Only (Mod,15)
>
> Problem arises when I need to some minus operations to find time
> differences
> Eg:
> Start Time : 08 Hours 45Minutes
> End Time : 10 Hours 15Minutes
> __________________________________________________________________
> Hours(1Hours) = EndHours_Text -
> StartHours_Text
> Minutes (30Minutes ~0.5Hours) = EndMinutes_Text -
> StartMinutes_Text
> ___________________________________________________________________
>
> End Value: 1.5 (Decimal or ANy Datatype)
>
> --
> Message posted via AccessMonster.com
> http://www.accessmonster.com/Uwe/Forums.aspx/access-formscoding/200812/1
>

Home | Search | Terms | Imprint Contact
Newsgroups Reader - provided by WiredBox.Net