To calculate the difference between two dates we have the macro sc\_date\_dif\_2, in this example we will see how it works and how to use it.

1. The format with which you are keeping within the database must be taken into account:

***Database Format***

![](https://desk.zoho.com/DocsDisplay?zgId=716875472&mode=inline&blockId=0a12g01107ca50e894330ae89960ebe726491)

***Macro Format Example in Documentation (<https://www.scriptcase.net/docs/en_us/v9/manual/14-macros/02-macros/>)***

***![](https://desk.zoho.com/DocsDisplay?zgId=716875472&mode=inline&blockId=0a12gd22160f178b1461f901c09bb3e531eb6)​***

2. Respecting that format we apply it within the macro sc\_date\_dif\_2, as follows in the Blank application, in the onExecute event:

![](https://desk.zoho.com/DocsDisplay?zgId=716875472&mode=inline&blockId=0a12gd9245e62b34140a1aaf88ffa30993195)

3. We save the changes and execute the application:

![](https://desk.zoho.com/DocsDisplay?zgId=716875472&mode=inline&blockId=0a12g80764464183a4a1e91ea48ef90b8a0cb)![](https://desk.zoho.com/DocsDisplay?zgId=716875472&mode=inline&blockId=0a12geaf61a6cf782434080feaa189decfa99)