Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
its_rajvir
Creator
Creator

Time Intervals

Dear Experts,

I am trying to create a field with half hour intervals from time field like this :

7:00 to 7:30
7:30 to 8:00
8:00 to 8:30
8:30 to 9:00
9:00 to 9:30
9:30 to 10:00........

I tried this:

Time(floor([TimeField],(1/48)),'hh:mm') & ' to ' & Time(ceil([TimeField],(1/48)),'hh:mm') as HalfHour Interval.

But it is giving me wrong output like this:

7:00 to 7:00
7:00 to 7:30
7:30 to 8:00
8:00 to 8:00
8:00 to 8:30
8:30 to 9:00
9:00 to 9:00
9:00 to 9:30
9:30 to 10:00

Kindly help me to get the correct output.

Thank You 

 

 

 

 

 

 

1 Solution

Accepted Solutions
hic
Former Employee
Former Employee

If the value of TimeField exactly corresponds to the full hour, then Floor() and Ceil() will return the same number. Compare with 

Floor(5) = Ceil(5) = 5

Instead, you could try 

Time(Floor(48*TimeField)/48,'hh:mm') & ' to ' & Time(Floor(48*TimeField+1)/48,'hh:mm') as HalfHour,

HIC

View solution in original post

2 Replies
hic
Former Employee
Former Employee

If the value of TimeField exactly corresponds to the full hour, then Floor() and Ceil() will return the same number. Compare with 

Floor(5) = Ceil(5) = 5

Instead, you could try 

Time(Floor(48*TimeField)/48,'hh:mm') & ' to ' & Time(Floor(48*TimeField+1)/48,'hh:mm') as HalfHour,

HIC

its_rajvir
Creator
Creator
Author

Thankyouu so Much @hic 😊