C Charles G Apr 1,803 16 Aug 11, 2016 #1 How would it be best be done? dates are in the form of m/d e.g. 9/8 for September 8th. some are also m/d/y if it's next year. thanks in advance.
How would it be best be done? dates are in the form of m/d e.g. 9/8 for September 8th. some are also m/d/y if it's next year. thanks in advance.
Charles Dye Super Moderator May 4,995 129 Staff member Aug 11, 2016 #2 Use @DATE to convert each to a julian, and subtract?
vefatica May 12,998 174 Aug 11, 2016 #3 Here's a start. But the date formats will need to be standardized. @MAKEAGE has a second parameter that lets you specify one of seven date formats Code: v:\> function days `%@eval[(%@makeage[%2]-%@makeage[%1]) / (10000000*60*60*24)]` v:\> echo %@days[2016-06-16,2016-08-11] 56 v:\> echo %@days[2016-06-16,2017-08-11] 421
Here's a start. But the date formats will need to be standardized. @MAKEAGE has a second parameter that lets you specify one of seven date formats Code: v:\> function days `%@eval[(%@makeage[%2]-%@makeage[%1]) / (10000000*60*60*24)]` v:\> echo %@days[2016-06-16,2016-08-11] 56 v:\> echo %@days[2016-06-16,2017-08-11] 421
vefatica May 12,998 174 Aug 11, 2016 #4 My first one was faulty. This is better and lets you use mm/dd/yy. Code: v:\> function days `%@eval[(%@makeage[%2,,1]-%@makeage[%1,,1]) / (10000000*60*60*24)]` v:\> echo %@days[8/11/16,8/11/17] 365
My first one was faulty. This is better and lets you use mm/dd/yy. Code: v:\> function days `%@eval[(%@makeage[%2,,1]-%@makeage[%1,,1]) / (10000000*60*60*24)]` v:\> echo %@days[8/11/16,8/11/17] 365
Joe Caverly Aug 1,948 71 Aug 11, 2016 #5 The VBScript DateDiff function is a solution that can be used with TCC; Code: @setlocal @echo off setdos /X-5 echo dtm1="01-Jan-16" > %@path[%_batchname]\dd.vbs echo dtm2="%_Day-%_Monthf-%_Year" >> %@path[%_batchname]\dd.vbs echo WScript.Echo "Difference between " & dtm1 & " and " & dtm2 >> %@path[%_batchname]\dd.vbs echo intMonthsDifferent=DateDiff("d", dtm1, dtm2) >> %@path[%_batchname]\dd.vbs echo WScript.Echo intMonthsDifferent >> %@path[%_batchname]\dd.vbs setdos /X0 iff exist %@path[%_batchname]\dd.vbs then cscript //nologo %@path[%_batchname]\dd.vbs del /q %@path[%_batchname]\dd.vbs else echo dd.btm - Error in creating %@path[%_batchname]\dd.vbs endiff endlocal More info on the VBScript DateDiff function->: [title] Joe
The VBScript DateDiff function is a solution that can be used with TCC; Code: @setlocal @echo off setdos /X-5 echo dtm1="01-Jan-16" > %@path[%_batchname]\dd.vbs echo dtm2="%_Day-%_Monthf-%_Year" >> %@path[%_batchname]\dd.vbs echo WScript.Echo "Difference between " & dtm1 & " and " & dtm2 >> %@path[%_batchname]\dd.vbs echo intMonthsDifferent=DateDiff("d", dtm1, dtm2) >> %@path[%_batchname]\dd.vbs echo WScript.Echo intMonthsDifferent >> %@path[%_batchname]\dd.vbs setdos /X0 iff exist %@path[%_batchname]\dd.vbs then cscript //nologo %@path[%_batchname]\dd.vbs del /q %@path[%_batchname]\dd.vbs else echo dd.btm - Error in creating %@path[%_batchname]\dd.vbs endiff endlocal More info on the VBScript DateDiff function->: [title] Joe
C Charles G Apr 1,803 16 Aug 11, 2016 #6 vefatica said: My first one was faulty. This is better and lets you use mm/dd/yy. Code: v:\> function days `%@eval[(%@makeage[%2,,1]-%@makeage[%1,,1]) / (10000000*60*60*24)]` v:\> echo %@days[8/11/16,8/11/17] 365 Click to expand... The *60*60*24 is obvious but why the 10000000 ?
vefatica said: My first one was faulty. This is better and lets you use mm/dd/yy. Code: v:\> function days `%@eval[(%@makeage[%2,,1]-%@makeage[%1,,1]) / (10000000*60*60*24)]` v:\> echo %@days[8/11/16,8/11/17] 365 Click to expand... The *60*60*24 is obvious but why the 10000000 ?
Charles Dye Super Moderator May 4,995 129 Staff member Aug 11, 2016 #7 Charles G said: The *60*60*24 is obvious but why the 10000000 ? Click to expand... Windows file age functions use 100ns ticks: ten-millionths of a second.
Charles G said: The *60*60*24 is obvious but why the 10000000 ? Click to expand... Windows file age functions use 100ns ticks: ten-millionths of a second.
C Charles G Apr 1,803 16 Aug 11, 2016 #8 Charles Dye said: Windows file age functions use 100ns ticks: ten-millionths of a second. Click to expand... ns = nanosecond? or was that supposed to be ms = miliseconds?
Charles Dye said: Windows file age functions use 100ns ticks: ten-millionths of a second. Click to expand... ns = nanosecond? or was that supposed to be ms = miliseconds?
Charles Dye Super Moderator May 4,995 129 Staff member Aug 11, 2016 #9 Charles G said: ns = nanosecond? or was that supposed to be ms = miliseconds? Click to expand... Nanoseconds: FILETIME structure The actual resolution used to record times may be far less.
Charles G said: ns = nanosecond? or was that supposed to be ms = miliseconds? Click to expand... Nanoseconds: FILETIME structure The actual resolution used to record times may be far less.
C Charles G Apr 1,803 16 Aug 14, 2016 #10 vefatica said: Here's a start. But the date formats will need to be standardized. @MAKEAGE has a second parameter that lets you specify one of seven date formats Code: v:\> function days `%@eval[(%@makeage[%2]-%@makeage[%1]) / (10000000*60*60*24)]` v:\> echo %@days[2016-06-16,2016-08-11] 56 v:\> echo %@days[2016-06-16,2017-08-11] 421 Click to expand... I like the function days above. How about similar functions xxx for function name @xxx[date,days] = returns date that is + or - days from specified date
vefatica said: Here's a start. But the date formats will need to be standardized. @MAKEAGE has a second parameter that lets you specify one of seven date formats Code: v:\> function days `%@eval[(%@makeage[%2]-%@makeage[%1]) / (10000000*60*60*24)]` v:\> echo %@days[2016-06-16,2016-08-11] 56 v:\> echo %@days[2016-06-16,2017-08-11] 421 Click to expand... I like the function days above. How about similar functions xxx for function name @xxx[date,days] = returns date that is + or - days from specified date
Charles Dye Super Moderator May 4,995 129 Staff member Aug 14, 2016 #11 Charles G said: I like the function days above. How about similar functions xxx for function name @xxx[date,days] = returns date that is + or - days from specified date Click to expand... Like this? @DATEPLUS Oh yeah; and also @DAYS
Charles G said: I like the function days above. How about similar functions xxx for function name @xxx[date,days] = returns date that is + or - days from specified date Click to expand... Like this? @DATEPLUS Oh yeah; and also @DAYS