Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
matbelli
Contributor
Contributor

Compare two dates to see if one is an hour after or before another one

Hi, i have a table like this:

CodiceAAMSNomeSalarc_id_ticketanti_data_emissioneAperturaChiusuraIf(anti_data_emissione <= Chiusura - MakeTime(1) and anti_data_emissione >= Apertura + MakeTime(1),
'Alert',
'OK')
anti_importo
EA170050445HSALA BINGO TRASTEVERE13132423579984139519/12/2018 10:51:5019/12/2018 09:00:0019/12/2018 23:00:00Alert605

 

I need to check if "anti_data_emissione" is between the interval [ Apertura,Apertura+1h] or [Chiusura-1h,Chiusura], in those cases my expression should give Alert, if "anti_data_emissione" is not in those interval, it has to say OK.

Thanks

1 Solution

Accepted Solutions
Anil_Babu_Samineni

May be try this?

If((anti_data_emissione>=Apertura and anti_data_emissione<=(Apertura+Hour(MakeTime(01)))) or (anti_data_emissione>=(Chiusura-Hour(MakeTime(01))) and anti_data_emissione<=Chiusura), 'Alert', 'OK')

Or

If((anti_data_emissione>=Apertura and anti_data_emissione<=(Apertura+1)) or (anti_data_emissione>=(Chiusura-1) and anti_data_emissione<=Chiusura), 'Alert', 'OK')

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful

View solution in original post

1 Reply
Anil_Babu_Samineni

May be try this?

If((anti_data_emissione>=Apertura and anti_data_emissione<=(Apertura+Hour(MakeTime(01)))) or (anti_data_emissione>=(Chiusura-Hour(MakeTime(01))) and anti_data_emissione<=Chiusura), 'Alert', 'OK')

Or

If((anti_data_emissione>=Apertura and anti_data_emissione<=(Apertura+1)) or (anti_data_emissione>=(Chiusura-1) and anti_data_emissione<=Chiusura), 'Alert', 'OK')

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful