6 Replies Latest reply on Apr 6, 2017 5:47 PM by GSalmson

# Calculation between times

Hi All,

I was wondering if someone could please tell me the correct way to write this calculation. I have an if statement with the below calculation

Get(CurrentTime) > "00;00;00"  &  Get(CurrentTime) < "12;00;00"

Basically what I want to say is that If it is morning do... I can do the ... I just can't get the if statement to fire properly.

Sorry for this one. I should be able to work this out, but it just isn't working for me.

Cheers and thanks

• ###### 1. Re: Calculation between times

use function Time ( Hours ; Minute ; Seconds )

then

Get(CurrentTime) > Time ( 00 ; 00 ; 00 ) and Get(CurrentTime) < Time ( 12 ; 00 ; 00 )

1 of 1 people found this helpful
• ###### 2. Re: Calculation between times

Why would you need the > condition?

If it is morning, it will always be less than 12 ; 00 ; 00  There can never be a time that is anything other than greater than 00 ; 00 ; 00

• ###### 3. Re: Calculation between times

Hi Johan,

That is the calculation and it works perfectly. Thank you . I often get confused between & and "and" The brackets make all the difference too.

Thanks heaps

• ###### 4. Re: Calculation between times

Mark you are right, but Get(current time) returns a result from the system clock. You are testing that result against a parameter of being between 0;0;0 and 12;0;0 ie. it is morning. I am not sure you can ask filemaker "is it morning?"

Johans calculation works perfectly.

Cheers

• ###### 5. Re: Calculation between times

Get(CurrentTime) < Time ( 12 ; 00 ; 00 )

Should produce identical results. Comparing Get ( CurrentTIme ) to midnight is meaningless and does not affect the results.

1 of 1 people found this helpful
• ###### 6. Re: Calculation between times

You are right Phil. You are truly the master.

As usual I was trying to overthink it. It does produce the same results.

Cheers and thanks