I think this will do it:

T: TDateTime;

Round( T * 12) / 12;    // Round to 2 hours
Round( T * 6) / 6;              // Round to 4 hours


David

-----Original Message-----
From: [email protected] [mailto:[EMAIL PROTECTED] On
Behalf Of Andries Bos
Sent: Thursday, November 03, 2005 9:19 AM
To: delphi advanced group
Subject: [delphi-en] rounding hours

Hello

I'm looking for a function to round an TDateTime  to
a) 2 and
b) 4 hours; 

e.g. if its 15h10 it should round to 16h00 when using the 2-hours
rouding. 
and at 4 hours interval it should be rounded to the nearest 24/4 hour. 

any ideas?

regards

andries


                
__________________________________
Yahoo! FareChase: Search multiple travel sites in one click.
http://farechase.yahoo.com



-----------------------------------------------------
Home page: http://groups.yahoo.com/group/delphi-en/
To unsubscribe: [EMAIL PROTECTED] 
Yahoo! Groups Links



 



------------------------ Yahoo! Groups Sponsor --------------------~--> 
Fair play? Video games influencing politics. Click and talk back!
http://us.click.yahoo.com/T8sf5C/tzNLAA/TtwFAA/i7folB/TM
--------------------------------------------------------------------~-> 

-----------------------------------------------------
Home page: http://groups.yahoo.com/group/delphi-en/
To unsubscribe: [EMAIL PROTECTED] 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/delphi-en/

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 



Reply via email to