ME» :DateTimeDifferences5Tòu 5Òâ@èà?ÿ0Òâ@e\Ô(éÿï? Òâ@Àÿâ@Date / Time DifferencesTUCalculates these up to 60years back, down to milliseconds if set in approprate formatTQTo set your own , format "yyyymmddhhmmsszzz" from text/ Date/Time input to stringT6This macro prompts for number of days/ years back etc,T%and checks against current dtae/ timeTmIt can be used to input your own start and end date/ time in %T1% and %T2% instead of prompting for days backT4It works by calculating number of months to go back TOthen asking for date of last day of last month and adding it to date differenceT?looping through for dat of end previous month etc... and addingTtill it reaches month neededTUThe PGM Function library is not needed, but can be selected to check after macro runsT1Only use it if installed! - PGM Function library T„N2FN1T$path Registry Name as env var; %Reg%T|JHKEY_CURRENT_USER\Software\Professional Grade Macros\PGM Functions\Swap\TRegT÷TDate / Time DifferencesT|CT‚g2FCenterCenter/PGM MACRO Library loaded?/ Prompt a day in past»Do you want to check the dates with PGM MACRO Library? (As a check after macro runs): Days / years back etc will be additive if requested Set Example by asking for days back from now&Yes -PGM Functions installed &Days Back &Hours before &Minutes before &Months before &Years before T‰T-1CT}bFFFCenterCenterDays beforeT†T‰T-1DT}`FFFCenterCenterHours beforeT†T‰T-1ET} aFFFCenterCenterMinutes beforeT†T‰T-1FT}_FFFCenterCenterMonths beforeT†T‰T-1GT}^FFFCenterCenterYears beforeT†T€^T^F12T€_T_T^TSet Original Date/TimeTÄ-yyyymmddhhmmsszzzT3%N99%%N96%%N97%%N98%TÄ$yyyymmddT3%N99%%N96%%N97%%N98%TÄ"yyyymmT3%N99%%N96%%N97%%N98%TSet Current Date/TimeTÄ-yyyymmddhhmmsszzzT300000000000000000000TÄ$yyyymmddT300000000000000000000TÄ"yyyymmT300000000000000000000TStart CalculationsT  T1T4TT  T5T2TT  T7T2TT  T9T2TT  T11T2T T  T13T2T T  T15T3TT T€F1000TSet Original Date/TimeTT  T1T4TT  T5T2TT  T7T2TT  T9T2TT  T11T2TT  T13T2T T  T15T3TT TF1000TSet DifferencesT€TTT€TTT€TTT€TTT€T TT€T T TTTTIf date same for eachT‰TTT}0T†T@If dates different, but both this month (or same month and year)T‰TTT€T†T(If dates different, and months differentT‰TTT find number of months differenceT€ TF12T€ T TT find date of last day last monthTÄddT30%N6%000000000000000TT€T€T+loop through previous months to be counted TTY%N33%000001000001TÄddT3%N18%000000000000000TT€TTT€TTTT†TOFinal calculation, using N17 as number of days difference as calculated alreadyTDisplay resultsT€TF24T€TTT€TF60T€TTT€TF60T€TTTNo secsTTTT No whole secsT(T No whole minsTTF60T€)T(F60T Residual secsT€-T)F60T-TTTNo completed hoursT€*T)F60T Residual minsT€,T*F60T€,T)T,TNo completed daysT€+T*F24TResidual hoursT€.T+F24T€.T*T.T6JT1000292000195000531000388000DIFFERENCES ENDT1=%T1%; T5=%T5%T6=%T6% DIFFERENCE; ME PGMFLM macrorun No secs diff = %D4% No mins diff = %D5% No Full minsdiff = %N42% No Full hours diff = %N43% Date number difference= %N17% No Completed Days Diff= %N44% Diff= %N44% Days, %N47% Hours, %N45% Mins, %D46% Secs T‰T-1ATFIf dates different, and months different PGMMETHOD for Date DifferenceT‰TTT|*{ DateTime - Date to Julian }, Date=%T5%T¬OHKEY_CURRENT_USER\Software\Professional Grade Macros\Pgm Functions\PgmFunctionT3{ PGM Function }T­MHKEY_CURRENT_USER\Software\Professional Grade Macros\Parameters\ReturnError?T·OHKEY_CURRENT_USER\Software\Professional Grade Macros\Parameters\ReturnDecimal1T|*{ DateTime - Date to Julian }, Date=%T6%T¬OHKEY_CURRENT_USER\Software\Professional Grade Macros\Pgm Functions\PgmFunctionT3{ PGM Function }T­MHKEY_CURRENT_USER\Software\Professional Grade Macros\Parameters\ReturnError?T·OHKEY_CURRENT_USER\Software\Professional Grade Macros\Parameters\ReturnDecimal1TTTT†TOFinal calculation, using N17 as number of days difference as calculated alreadyTDisplay resultsT€TF24T€TTT€TF60T€TTT€TF60T€TTTNo secsTTTT No whole secsT(T No whole minsTTF60T€)T(F60T Residual secsT€-T)F60T-TTTNo completed hoursT€*T)F60T Residual minsT€,T*F60T€,T)T,TNo completed daysT€+T*F24TResidual hoursT€.T+F24T€.T*T.T6dT1000292000195000531000388000)DIFFERENCES PGMMETHOD for Date DifferenceT1=%T1%; T5=%T5%T6=%T6% DIFFERENCE; ME PGMFLM macrorun No secs diff = %D4% No mins diff = %D5% No Full minsdiff = %N42% No Full hours diff = %N43% Date number difference= %N17% No Completed Days Diff= %N44% Diff= %N44% Days, %N47% Hours, %N45% Mins, %D46% Secs T†TT¹T\B*B