Setting end time

Is there any way to automatically set the end time exactly as one hour later than the start time without any user intervention and making the field non editable ?

in my case is for classes and they all have one hour. So there is no point in allowing the user to choose a different time, but the end time is needed in the Database for other purposes and if the user messes up…big problem in another app.

Many thanks

JM

Yes. In the event onafterinsert you can add the hour to the start time. To set the field non editable set the label property to true. If it needs to do the same on update you might use the onvalidate or onvalidateok event.

one hour after “now”:

$timestamp = time();
$justnow = date(“Y-m-d”, $timestamp);
$justhor=date(“H”, $timestamp)+1;
$justmin=date(“i”, $timestamp);
$endzeit=$justhor.":".$justmin.":00";

one hour after given time:

{mytime}=“15:15:15”;
$justhor=substr({mytime},0,2)+1;
$justmin=substr({mytime},3);
$endzeit=$justhor.":".$justmin;

well, just written without much thinking, i bet there is a more elegant solution. but i think this works too.

Another way might be: $endTime = date(“H:i”,strtotime(’+60 minutes’,$time));

Thanks. I will try to implement these.

JM

Hi, Ive just got into watching wimbledon but i know NOTHING about tennis. Ive noticed that sometimes a set ends when the games are 6-4 for example or 5-3. Anything like that. But sometimes (as in the doubles game im watching now), the games stand at 10-11 and the set still hasn’t ended. Now i know it doesn’t go by time, so i would like to know, when does a set end?