Announcement

Collapse
No announcement yet.

Setting end time

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • 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

  • #2
    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.
    Albert Drent
    aducom software netherlands
    scriptcase partner, reseller, support and (turn-key) development
    www.scriptcase.eu / www.scriptcase.nl

    Comment


    • #3
      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.
      Last edited by nina_sorensen; 11-07-2013, 09:39 AM.

      Comment


      • #4
        Another way might be: $endTime = date("H:i",strtotime('+60 minutes',$time));
        Albert Drent
        aducom software netherlands
        scriptcase partner, reseller, support and (turn-key) development
        www.scriptcase.eu / www.scriptcase.nl

        Comment


        • #5
          Thanks. I will try to implement these.

          JM

          Comment


          • #6
            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?
            matrimonial sites for Kumaonis | Matrimonial Sites |

            Comment

            Working...
            X