# Script Duration

This Databox reads from a [system-values](https://docs.keyfax.biz/product-suite/admin/entities/databoxes/system-values "mention") **Databox** that represents the current date and time and stores this in the Databox **Keyfax.Timer started** at the point that you wish to start timing.&#x20;

### Databox Creation

You will first need to create the [system-values](https://docs.keyfax.biz/product-suite/admin/entities/databoxes/system-values "mention") Databox as shown below\...

<div align="center"><figure><img src="https://2882349412-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MARm6St_qFGM52R3pBa%2Fuploads%2FqcuUEWt4zsx8v9CR3l5J%2F2023-05-15_11h37_25.png?alt=media&#x26;token=81b315a8-fe58-4308-ab18-e20b588b4c52" alt=""><figcaption><p>The current date and time</p></figcaption></figure></div>

<div align="center"><figure><img src="https://2882349412-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MARm6St_qFGM52R3pBa%2Fuploads%2FSo9vOcbVkxeTuVlXKcHN%2F2023-05-15_11h38_50.png?alt=media&#x26;token=4cd1a4c8-19a5-46a5-9922-7c732484e7c2" alt=""><figcaption><p>Recording exactly when the timer started...</p></figcaption></figure></div>

<div align="center"><figure><img src="https://2882349412-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MARm6St_qFGM52R3pBa%2Fuploads%2FRsPuEfBER8LAz1fZrUdf%2F2023-05-15_11h40_33.png?alt=media&#x26;token=ea16e865-653e-4c8f-9bee-fb16f77d652f" alt=""><figcaption><p>Calculating the difference using a SQL query</p></figcaption></figure></div>

### End Result

This can be demonstrated in a simple script comprising 3 steps. The first saves the current time, the second is a random question and the third displays a message showing the time spent. &#x20;

<figure><img src="https://2882349412-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MARm6St_qFGM52R3pBa%2Fuploads%2FX4GRInFjR310TLlGRPvg%2F2023-05-15_11h43_28.png?alt=media&#x26;token=4473f837-613b-4131-8824-10579fbdbb06" alt=""><figcaption><p>Demonstrating how to use the timer</p></figcaption></figure>

Here is the message...

<figure><img src="https://2882349412-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MARm6St_qFGM52R3pBa%2Fuploads%2FOXhVKXR294hyJVq72Lem%2F2023-05-15_11h49_10.png?alt=media&#x26;token=47ee6ff6-be02-43d5-a87c-442c1d1cd761" alt=""><figcaption><p>The Message used in the above script</p></figcaption></figure>

And the final output...

<figure><img src="https://2882349412-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MARm6St_qFGM52R3pBa%2Fuploads%2FeMb6ILL4lNWUXCU2staH%2FTime%20In%20Scripts%204.4.7.png?alt=media&#x26;token=db09de9f-1223-45f3-ba66-e80d94c75a6f" alt=""><figcaption><p>Message showing results of time spent in script</p></figcaption></figure>

{% hint style="info" %}
**NOTE:** The actual time spent in the script may be usefully returned to the host or calling application. The timer would normally be started in a **Startup Script** and the number of seconds could be returned to the host in a **Results Script**.
{% endhint %}
