Timeformat question

If you have questions or if you want to share your opinion about Aware IM post your message on this forum
Post Reply
Rem
Posts: 216
Joined: Wed Oct 03, 2007 8:58 am
Location: Sweden
Contact:

Timeformat question

Post by Rem »

I´m sure this question is simple, but I can´t figure it out.

I´m making a comparison using different times. Say I want to know if something has ended after 17:00.

If I test with xx.endtime>=17:00 it doesn´t work. So I made a small workaround. I made a systemsetting called systemsetting.time1700 and assigned the time 17:00.

And when I make this comparison xx.endtime>=systemsetting.time1700 it works.

But it really feels stupid. So since I´m obvioulsy is missing out on something here can anyone explain this?

/Rem
tford
Posts: 4238
Joined: Sat Mar 10, 2007 6:44 pm

Post by tford »

Rem,

One other way would be to use the HOUR function as explained on page 319 of User Guide: IF HOUR(xx.endtime)>=17 .....

If you need to also involve minutes, use the MINUTE function on page 320.

Your use of SystemSettings was pretty resourceful though :)

Tom
Rem
Posts: 216
Joined: Wed Oct 03, 2007 8:58 am
Location: Sweden
Contact:

Post by Rem »

Thanks Tom, that worked, but isn´t there a way to compare the actual time without splitting it up into hours and minutes.

The problem now is that if I compare with 17 it goes all the way to 17:59 (and in my calucation that is not OK, and if I end at 16 I will miss one hour).

So, my workaround is still doing a better job but why can I not just type 17:30 in the rule? That is how I type it in the form.

/Rem
tford
Posts: 4238
Joined: Sat Mar 10, 2007 6:44 pm

Post by tford »

Rem,

I THINK the reason you can't use 17:30 is that AwareIM is similar to Excel in that it stores time info in formats that are different from what you see. Hence, the reason for functions to manipulate them.

Your workaround works because you are comparing 2 stored numbers that are stored in the same manner.

Tom
christopherb
Posts: 304
Joined: Fri Jun 22, 2007 8:26 pm

Post by christopherb »

Rem,
If you are doing your calculation(s) in real time then you can look for the time/hour/minute as needed using your server's time. Of course if your server is hosted in another area of the country that may not work for you...

Example;

IF CURRENT_HOUR < 17 AND IF CURRENT_MINUTE < 15 Then do whatever


The Current Hour return an integer constant 0-23 while Current Minute returns 0-59


Hope that helps,
Christopher
Rem
Posts: 216
Joined: Wed Oct 03, 2007 8:58 am
Location: Sweden
Contact:

Post by Rem »

Well, actually I´m calculating time spent on consulting a client (customer). We have different rates depending on when the job is done.

So if the job starts at 15:30 and ends at 23:00, the customer should pay for 1,5 horus daytime (to 17:00) and 5 hours evening time and 1 hour nighttime. So for every calculation I have two parameters involving both hours and minutes and 4 different timerates, before 8 oclock, between 8 and 17, between 17 and 22 and after 22. So it gets a bit complicated.

And if you cant use the actual time, like 17.15 it gets nearly imposible.

If I should write this in normal code I should have used variables and started to fill them with time and in the end have four variables which each should have hold the time for mornig, day, evening and night, but as I understand Aware doesn´t work the same way as a programming language?

Sounds easy, but thats the difference between the human brain and computers.

/Rem
christopherb
Posts: 304
Joined: Fri Jun 22, 2007 8:26 pm

Post by christopherb »

Rem,
You should be able to do all that in a process as long as you stay with the military time clock. It will get a little wordy. I can see it in my head and I will try and post a sample for you when I get a little time....



=Christopher
Post Reply