Link Search Menu Expand Document

Time Entity Functions

Sep 28 2022 at 12:00 AM

  1. Time Between
  2. Date Difference
  3. Time While True
  4. Current Time
  5. Day To Now
  6. Month To Now
  7. Year To Now
  8. Date Time Part
  9. To Time Zone

Time Between

Function Description:

The Time Between function determines the time difference, in seconds, between two separate conditions.

Function Structure:

Figure 1 - Time Between

Inputs Required:

  • Condition 1 - An entity function or constant, thereafter values can be added as endpoints in Time Span format.
  • Condition 2 - An entity function or constant, thereafter values can be added as endpoints in Time Span format.

Output Expected:

  • Time - A time difference in seconds.

Use Case Example(s)

Example 1

Timespan 1Timespan 2Time Between (Seconds)
2018/01/01 00:00:002018/01/01 01:00:00360

Example 2

Timespan 1Timespan 2Time Between (Seconds)
2018/01/01 00:01:002018/01/01 00:00:0060

Use Case Scenario(s)

1. A security guard on patrol needs to reach tag-points within a specified interval.
2. The Gautrain needs to reach Rosebank from Hatfield within an hour or there will be time constraints on the system and passengers.
3. A truck driver needs to offload cargo at specified drop off points. It will track how much time it takes the driver to move from one drop off point to another. This helps the company to design better delivery mapping.

Date Difference

Function Description:

This function is used to calculate the difference in days, hours, minutes, and seconds between two DateTime inputs.

Function Structure:

Figure 2 - Date Difference

Inputs Required:

  • DateTime 1 - An endpoint in DateTime format.
  • DateTime 2 - An endpoint in DateTime format.

Output Expected:

  • DateTime - It returns a DateTime (dd.hh.mm.ss) value.

Use Case Example(s)

1. This function will tally the difference between the Date and Time A (dd.hh.mm.ss) and Date and Time B (dd.hh.mm.ss).

Figure 3 - Date Difference Function

Use Case Scenario(s)

1. How many days, hours, minutes, seconds have passed since your sprinklers went on in your garden. The function will calculate from that given date till now (current time).
2. When was the last time a haulage truck driver went for an eye test and health check-up? This will help the company adhere to health and safety protocols.
3. When last did the truck or vehicle go in for a service? This function can be aligned to the manufacturer‘s service plan so that the company can see the cost benefit analysis of a particular brand of vehicle or a particular vehicle in the fleet.

Time While True

Function Description:

Time While True is used to calculate how long an endpoint/function is True for in intervals. Once the condition reaches a false state it returns a double value which represents the total seconds that the function was true.

Function Structure:

Figure 4 - Time While True

Inputs Required:

  • Condition - An endpoint in boolean format, or a condition built from a function, or set of functions, which would provide a boolean output.

Output Expected:

  • Time - Time (in seconds) whilst the boolean condition was True.

Use Case Example(s)

Example 1

Endpoint NameValueTime While True Result (seconds)Why
2018/01/01 10:00:00false0First time the function ever executed
2018/01/01 10:00:02true0The function is true for the first time, so time true results in 0 seconds
2018/01/01 10:00:04false2The function gets set to false for the first time, sets the time while it was true to 2 seconds

Example 2

Endpoint NameValueTime While True Result (seconds)Why
2018/01/01 10:00:06true0The function is true for the first time, so time true results in 0 seconds
2018/01/01 10:00:20true14Time between current value and the last true value
2018/01/01 10:00:21false15The function gets set to false for the first time, sets the time while it was true to 15 seconds

Use Case Scenario(s)

1. If a generator is being refuelled, how long did it take from when the cap was removed for the refuelling to being, until the cap was closed and the tank was full.
2. If freezer door is opened, for how long was it open, and by how much did the temperature drop in the time it was open.

Current Time

Function Description:

This is used to output the current local time today for your time zone.

NOTE
This function will not output anything as the current time function is supposed to be used within other functions. If you wish for it to output the current time, you will need to include a a triggering function, such as an if true statement, to calculate the current time today.

Function Structure:

Figure 5 - Current Time

Inputs Required:

  • Input - This function can only be applied within a trigger function.

Output Expected:

  • Time - It returns the current local time if it is within a trigger function.

Use Case Example(s)

Figure 6 - Current Time With Trigger

1. The Current Time function is not to be used on its own in a function. If you do wish to have a function just calculating the current time you would need a triggering function such as IF TRUE (see the figure above).

Use Case Scenario(s)

1. A bus wants to notify its passengers of the time, the next stop and how long it will take to get there. If the door opens either to pick up or drop off a passenger, the current time will be displayed, as well as the amount of time it will take to get to the next bus stop.

Day To Now

Function Description:

Day To Now is used when you would like to action a function or trigger at a specified time. It will action a function or trigger at a specified time of the day, and reset each day at that same time. This feature is used for resetting values, and it can be added to other functions that are performing counts for it to perform a function.

NOTE
Always specify your time zone to ensure that it is within your time parameters.

Function Structure:

Figure 7 - Day To Now

Inputs Required:

  • Time Zone - A constant. Select from a drop-down list the time zone required for the calculation.
  • Time - A constant. The specific time of day that the function should action and reset every day (HH:MM:SS).

Output Expected:

  • Output - Function or trigger will output value of the use case, and resets it at the specified time.

Use Case Example(s)

Time ZoneTimeDescriptionNote
HarareStart hour to reset valuesWhat time would you like this function to execute every day.It will reset at the same time every day.

Figure 8 - Reset Value

1. You will use this function to reset your value every day at midnight. Every day at that time an action of the function is performed.

Figure 9 - Day To Now Function

2. You will use this function to reset your value every day at 02:00am.

Use Case Scenario(s)

1. Set a trigger in a day to remind user of maintenance service.
2. At a specific time in a day (e.g., 6pm), to automatically switch on the streetlights, and you can also set them to automatically switch off at 6am.

Month To Now

Function Description:

Month To Now is used when you would like to action a function or a trigger on a specific day. at a specified day of the month, which will then reset on that same day each month.

Function Structure:

Figure 10 - Month To Now

Inputs Required:

  • Time Zone - Required: A constant. Select from a drop-down list the time zone required for the calculation.
  • Time - A constant. The specific day of the month that the function should action and reset every month.

Output Expected:

  • Output - Function or trigger will output value of the use case, and reset on the specified day of the month.

Use Case Example(s)

Time ZoneTimeDescriptionNote
HarareSpecific day of the month to reset values.What day would you like this function to execute every month.It will reset at the same day of the month.

Figure 11 - Month To Now Function

1. You will use this function to action and then reset your function or trigger on the 26th day of each month (within the parameters of the time zone indicated). It actions the function on that specified day of the month and resets on the same specified day of the next month according to your time zone.

Use Case Scenario(s)

1. Set a trigger on a specific day of the month to remind user of maintenance service.
2. Measure how much energy has been used for a month and if that value has changed for that period.

Year To Now

Function Description:

This is used when you would like to action a function or trigger on a specific day of a specific month each year., and it will refresh on that month to start the year on. It always starts the action of the function on that month to start the year on.

Function Structure:

Figure 12 - Year To Now

Inputs Required:

  • Time Zone - Select from a drop-down list the time zone required for the calculation.
  • Time - The specific day of the month that the function should action and reset every month.
  • Time - The specific month of the year that the function should action and reset every year.

Output Expected:

  • Output - Function or trigger will output value of the use case, and reset on the specified month of the year.

Use Case Example(s)

Time ZoneTimeDescriptionNote
HarareStart day and month of each year to reset valuesWhat time would you like this function to execute each year.It will reset at the same time every year.

Figure 13 - Year To Now Function

  1. You will use this function to action and reset your function or trigger on the 1st day of the 7th month (July).

Use Case Scenario(s)

1. Set a trigger in a year to remind user of maintenance service.
2. Measure how much energy has been used for a year and if that value has changed for that period.
3. Set a trigger as a reminder, and to reset the date for the next financial year end.

Date Time Part

Function Description:

This function singles out a specific parameter from a timespan. It will output only the section specified. It displays the endpoint at the interval of which data is received.

Function Structure:

Figure 15 - Date Time Part

Inputs Required:

You are required to input constant values for the following:

  • Time Part - This can either be that year, month, day, hour, minute or seconds.
  • Time Zone - This can be selected from the list of time zones provided in the dropdown menu.
  • Endpoint - This value is from the Date and Time Between output.

Output Expected:

  • Output - It displays part of the timespan based on the time zone you selected.

Use Case Example(s)

Example 1

Date and Time Between ValueTime PartTime ZoneDay Time Part Return
4:02:13:13DayAfrica / Johannesburg4

Example 2

Date and Time Between ValueTime PartTime ZoneDay Time Part Return
4:02:13:13HourAfrica / Johannesburg2

Figure 16 - Date Time Part Function

Use Case Scenario(s)

1. You can single out just the number of days it has been from a DateTime value, using this time function. You can pull out the day only by using this function. This is achieved by taking the day function out of your Date and Time Between of when you last watered your plants in your time zone.

To Time Zone

Function Description:

This feature is used to adjust the value being received for the correct time zone. It is used in conjunction with other functions to correct timespan outputs.

Function Structure:

Figure 17 - To Time Zone

Inputs Required:

  • GMT Offset - You give it a constant and input your offset for your time zone to (GMT) Greenwich Mean Time.

Output Expected:

  • Output - It displays part of the timespan based on the time zone you selected.

Use Case Example(s)

Figure 18 - To Time Zone Function

1. This is an example of what it would look like when you input an offset for your time zone.

Use Case Scenario(s)

1. If you are living in South Africa, you would use this to adjust the Greenwich Mean Time (GMT) by two hours.