Please enable JavaScript to view this site.

Vensim Help

Navigation: Reference Guide > Functions > Time Functions

GET TIME VALUE(relativeto,offset,measure) GET VALUE of TIME with different measurements

Scroll Prev Top Next More

Returns the specified measure of TIME relative to the current, initial or clock time offset by the specified amount. This allows you to get values for the month of the year, the day of the month, and the day of the week among others.

relative to: 0 for the current simulation time, 1 for the initial simulation time and 2 for the current computer clock time.

offset is the difference in time, as measured in the units of Time for the model, to move before computing the value. offset is ignored when relativeto is 2.

measure allows you to choose between different units and measurements for time. The values are:

0 units of Time in the model (only for relativeto 0 and 1)

1 years since 1 BC (an integer, same as the normal calendar year)

2 quarter of year (1-4)

3 month of year (1-12)

4 day of month (1-31)

5 day of week (0-6 where 0 is Sunday)

6 days since Jan 1., 1 BC (year 1 BC is treated as year 0)

7 hour of day (0-23)

8 minute of hour (0-59)

9 second of minute (0-59.99 – not an integer)

10 elapsed seconds modulo 500,000 (0-499,999)

 

Measure 10 is intended primarily as a convenient mechanism for initializing NOISE SEED when it is desired that each simulation generate a different result.

Units: GET TIME VALUE(number,time units,number) --> number

Because the correct units depend on the value of the final units checking is not performed on this function. Using it is the same as using a number in an equation as far as units are concerned.

Notes: This function uses the time labeling set up in Model>Settings>Time Bounds. If the units for this are year, quarter or month then days and dates are calculated using a 360 day year. If the units are week or day actual days and dates are computed accommodating leap years. If the units are hour, minute or second year, month, quarter and days are all set to 0.

Example

Same as time = GET TIME VALUE(0,0,0) {returns same value as Time}

NOISE SEED = INITIAL(GET TIME VALUE(2,0,10)) { different random seed every start }

INITIAL TIME = INITIAL(GET TIME VALUE(2,0,6)-730484) { using this and FINAL TIME=INITIAL(INITIAL TIME+LENGTH) will start simulations on the current date.

 

Availability: Not PLE or PLE Plus

See also: Time Bounds and Dates

Sample model: GET TIME VALUE.mdl in FunctionExamples