Announcement

Collapse
No announcement yet.

vTime.getDate() for time intervals

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

  • vTime.getDate() for time intervals

    I would like to constrain a part of my efs to work within specific time intervals. I have no problem getting an interval of between 9 and 12 to work for instance, which would be:

    var hour= 0;
    var min =0;
    var vTime = getValue("Time");
    hour=vTime.getHours();
    min = vTime.getMinutes();

    (hour > 8 && hour < 13)

    ...but I haven't been able to get an interval with a minute constraint, ie 9:30 to 12:30 .

    I've tried stuff like: ((hour == 9 && min >= 30) && ((hour<13) || (hour == 15 && min < 30)))

    but no dice.
    Could someone help with this?

    Ian

  • #2
    Ian
    Multiply getHour() by 100 to which you can then add getMinute() to obtain hhmm.
    For example
    if ((getHour()*100)+getMinute() >= 930 && (getHour()*100)+getMinute() < 1600)
    Alex

    Comment


    • #3
      Works great Alexis. Thank you for a simple solution!

      Ian

      Comment

      Working...
      X