Time Between & Date Between

Post any questions you have about using the Verj.io Studio, including client and server-side programming with Javascript or FPL, and integration with databases, web services etc.

Moderators: Jon, Steve, Ian, Dave

selbjx
Ebase User
Posts: 22
Joined: Fri Jun 06, 2008 8:35 am

Time Between & Date Between

#1

Postby selbjx » Wed Apr 11, 2012 10:42 am

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.
0 x

Hovik
Moderator
Moderator
Posts: 184
Joined: Tue Sep 11, 2007 8:58 am

#2

Postby Hovik » Wed Apr 11, 2012 1:52 pm

You can do arithmetic with date and time fields. e.g.

Code: Select all

set TDIFF = END_TIME - START_TIME;
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).
0 x

selbjx
Ebase User
Posts: 22
Joined: Fri Jun 06, 2008 8:35 am

#3

Postby selbjx » Wed Apr 11, 2012 2:03 pm

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
0 x

Hovik
Moderator
Moderator
Posts: 184
Joined: Tue Sep 11, 2007 8:58 am

#4

Postby Hovik » Wed Apr 11, 2012 2:21 pm

Hi Jon,

You can also compare date and time fields. e.g.

Code: Select all

if &#91;MID_TIME >= START_TIME and MID_TIME <= END_TIME&#93;
0 x

selbjx
Ebase User
Posts: 22
Joined: Fri Jun 06, 2008 8:35 am

#5

Postby selbjx » Wed Apr 11, 2012 3:07 pm

Hovik wrote:Hi Jon,

You can also compare date and time fields. e.g.

Code: Select all

if &#91;MID_TIME >= START_TIME and MID_TIME <= END_TIME&#93;
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.

Cheers
0 x

selbjx
Ebase User
Posts: 22
Joined: Fri Jun 06, 2008 8:35 am

#6

Postby selbjx » Tue Apr 17, 2012 1:27 pm

Hi hovik,

Now resolved, thanks for your help, much appreciated

Jon
0 x


Who is online

Users browsing this forum: No registered users and 40 guests