User Submitted Macro

Date Time Difference Calculator

Written by Randall Clapp

What it does

Calculates the difference between two Date/Time up to 60 years back, down to milliseconds if set in approprate format. This macro prompts for number of days/years back etc. and checks against current date/time.

To install

Download the macro file umdatetimedifferences.mex and save it to your hard drive where you store your macro file(s). Import the macros into your existing macro file by clicking File, Import, Import Macros.

To use

Click on the icon in the Macro Explorer.

To write your own dates to input, format “yyyymmddhhmmsszzz” from text/ Date/Time input to string. It can be changed to input your own start and end date/ time in %T1% and %T2% instead of prompting for days back.

How it works

It works by calculating number of months to go back, then asking for date of last day of last month and adding it to date difference, looping through for date of end previous month etc. and adding, till it reaches month needed.

Requirements

Macro Express 3
The PGM Function library is NOT needed, but can be selected to check after macro runs (only checks date calculation, not time! (Only use PGM Function library part if installed)

** Randall wins a Macro Express T-shirt for his submission.