Skip to content

day_of_week

Syntax

day_of_week()

Description

Returns an integer representing the day of the week in a simulation.

To improve legibility of a model's code, this can be compared with a day of the week constant. The constants for the day of the week are evaluated as follows:

           | Day of Week String | Value               |
           | ------------------ | ------------------- |
           | `Sun`              | `0`                 |
           | `Mon`              | `1`                 |
           | `Tue`              | `2`                 |
           | `Wed`              | `3`                 |
           | `Thu`              | `4`                 |
           | `Fri`              | `5`                 |
           | `Sat`              | `6`                 |

Examples

The transition statement below sends agents to the Closed state if the day of the week is Sunday:

next_if(Closed, day_of_week() == Sun)

See Also