# Midnight Calculation

This topic is 6946 days old. Please don't post here. Open a new topic instead.

## Recommended Posts

I'm writing a script that creates a number of 15-min periods (Timeslots) over a period of days.

I have been successful with the First Day (e.g. ((Time( 24, 00, 00) - CalItem_Start_Time)/60)/15) and the Next Day(s) but have run into a dead-end when trying to get the Timeslots for the Last Day.

I have an End Time and want to take the End Time from Midnight but cannot get my head around it.

Can anyone help?

##### Share on other sites

Try 00:00 and see if that helps

##### Share on other sites

FMP stores time as the number of seconds from midnight.

##### Share on other sites

Thanks for your response, Lee but the zeros don't reduce my End Time data (e.g. End Time = "11:30" less "00:00" still gives me "11:30")

##### Share on other sites

Lee, I think I've got it.

If I treat the End Time as a number in a calculation (Field:"End Time" Result: Number) and then divide it by 60 to get the minutes so that "11:30" - using the 24-hour clock - gives me "690" (likewise, "23:30" gives me "1410") I am now able to get my 15-minute periods from the previous midnight (Midnight = "00:00") simply by dividing 690 by 15.

Thanks to you and Vaughan for your help.

##### Share on other sites

This topic is 6946 days old. Please don't post here. Open a new topic instead.

## Create an account

Register a new account