Do any such functions exist which cover the above operations?
I need to find times between certain time ranges and can see no simple way of doing this.
Time Between & Date Between
Moderators: Jon, Steve, Ian, Dave
-
Hovik
- Moderator

- Posts: 184
- Joined: Tue Sep 11, 2007 8:58 am
You can do arithmetic with date and time fields. e.g.
where START_TIME and END_TIME are both TIME fields.
If TDIFF is an integer field, the result will be number of seconds. if TDIFF is a time field, the result will be a time in format HH:MM:SS
You can use the same approach with dates, except subtracting 2 dates will give you number of days (you can not put the result in another date field).
Code: Select all
set TDIFF = END_TIME - START_TIME;If TDIFF is an integer field, the result will be number of seconds. if TDIFF is a time field, the result will be a time in format HH:MM:SS
You can use the same approach with dates, except subtracting 2 dates will give you number of days (you can not put the result in another date field).
0 x
-
selbjx
- Ebase User
- Posts: 22
- Joined: Fri Jun 06, 2008 8:35 am
Thanks for the response Hovik.
I've been a bit slack in my detail and I've now worked through the issue.
What I actually wanted was a function to do the following:
I have a time range, say 07:00- 16:59 and needed to know whether 12:00 is in this range. I quickly put together a little function which does what I needed.
Many thanks
Jon
I've been a bit slack in my detail and I've now worked through the issue.
What I actually wanted was a function to do the following:
I have a time range, say 07:00- 16:59 and needed to know whether 12:00 is in this range. I quickly put together a little function which does what I needed.
Many thanks
Jon
0 x
-
Hovik
- Moderator

- Posts: 184
- Joined: Tue Sep 11, 2007 8:58 am
Hi Jon,
You can also compare date and time fields. e.g.
You can also compare date and time fields. e.g.
Code: Select all
if [MID_TIME >= START_TIME and MID_TIME <= END_TIME]
0 x
-
selbjx
- Ebase User
- Posts: 22
- Joined: Fri Jun 06, 2008 8:35 am
Odd, i'll give that another try tomorrow - it didn't work for me first time round, hence why I opted to build a java function.Hovik wrote:Hi Jon,
You can also compare date and time fields. e.g.
Code: Select all
if [MID_TIME >= START_TIME and MID_TIME <= END_TIME]
Cheers
0 x
-
selbjx
- Ebase User
- Posts: 22
- Joined: Fri Jun 06, 2008 8:35 am
Who is online
Users browsing this forum: No registered users and 33 guests