Checking AM or PM
Author Message
Checking AM or PM

Hi all

I want to check the computer time for am or pm (ver 2003)

if clock() < 12   (this would be before noon)

if clock() > 12  (this would be afternoon)

is this right or does one have to compute the seconds

Don Harvey

Sun, 18 Feb 2001 03:00:00 GMT
Checking AM or PM
Don,
if clock() > 4320000 then its PM else its AM.
This is because Clarion treats the time as 100ths of a second since
midnight.

HTH

Sun, 18 Feb 2001 03:00:00 GMT
Checking AM or PM
Yep,

That works perfect.  Many thanks.

Don

Quote:

>Don,
>if clock() > 4320000 then its PM else its AM.
>This is because Clarion treats the time as 100ths of a second since
>midnight.

>HTH

Mon, 19 Feb 2001 03:00:00 GMT
Checking AM or PM

Quote:
>if clock() > 4320000 then its PM else its AM.
>This is because Clarion treats the time as 100ths of a second since
>midnight.

Make that 4320000 + 1

0 is no time
1 is midnight

4320001 would display as 12:00

(A 1/100 second makes the display appear to be out by 1 minute!)

Regards
Malcolm Collett
------------------------------
mcollett AT iafrica DOT com
==============================

Mon, 19 Feb 2001 03:00:00 GMT
Checking AM or PM
for clarity and easy readability od my code, I use:

Quote:

>>if clock() > 4320000 then its PM else its AM.
>>This is because Clarion treats the time as 100ths of a second since
>>midnight.

>Make that 4320000 + 1

>0 is no time
>1 is midnight

>4320001 would display as 12:00

>(A 1/100 second makes the display appear to be out by 1 minute!)

>Regards
>Malcolm Collett
>------------------------------
>mcollett AT iafrica DOT com
>==============================

Tue, 20 Feb 2001 03:00:00 GMT
Checking AM or PM

Quote:

> >if clock() > 4320000 then its PM else its AM.
> >This is because Clarion treats the time as 100ths of a second since
> >midnight.

> Make that 4320000 + 1

> 0 is no time
> 1 is midnight

> 4320001 would display as 12:00

> (A 1/100 second makes the display appear to be out by 1 minute!

Exactly right on the time. Thats why I am checking to see if its GREATER
than 4320000. As such, there is no need to add anything to the clock.

Tue, 20 Feb 2001 03:00:00 GMT

 Page 1 of 1 [ 6 post ]

Relevant Pages