![]() Emacs with dired-mode makes a lot more sense, but sometimes I feel like working outside of Emacs. Likewise, I can do this on the command line in Terminal, but sometimes I don’t want to. That led me on a search to find a more capable replacement for Finder. (is a great piece of software and it is ) totally free. Rules for how CMD.EXE parses numbers - DosTips forum (Dave Benham).I was on Lion when I started using it and XtraFinder gave me tabs and a bunch of other features that Lion didn’t have. How-to: PowerShell variables - these support Math operations out of the box (.addDays) SetLocal - Control the visibility of environment variables in a batch file. Tdiff.cmd - Calculate the difference in Hours/Mins between two time values. “We were having one of those great first dates you can only have when it's not an actual date” ~ Sarah Jessica Parker Related commands ![]() ExamplesĭATEMATH - Subtracting one date from another = days differenceĭATEMATH - add or subtract days from a date = new date addDays, VBScript has DateAdd, both of which accept negative numbers for subtractions. In other languages, performing basic math on date values is much easier, PowerShell has. IF %v_mm% GTR 9 (SET v_mm_str=%v_mm%) ELSE (SET v_mm_str=0%v_mm%)ĮCHO DATEMATH - add or subtract days from a date = new date If %v_dd% LEQ 31 goto s_add_subtract_days_DONE If %v_dd% LEQ 30 goto s_add_subtract_days_DONE If %v_dd% LEQ 29 goto s_add_subtract_days_DONE If %v_dd% LEQ 28 goto s_add_subtract_days_DONE If %v_leapyear% EQU %v_yy% goto s_subtract_leapyear If %v_mm% LEQ 12 goto s_subtract_days_%v_mm% If %v_leapyear% NEQ %v_yy% goto s_adjust_month_year If %v_dd% GEQ 1 goto s_add_subtract_days_DONE SET /a v_dd_int=%v_sumdays1% - %v_sumdays2%ĮCHO DATEMATH - Subtracting one date from another = days difference If %v_yy2% GTR 99 goto s_validate2nd_month :: Subtracting one date from another :::::: IF %v_mm% LEQ 9 (SET v_mm_str=0%v_mm%) ELSE (SET v_mm_str=%v_mm%)ĮCHO DATEMATH - Convert date only (no maths) :: Determine which function to perform - ADD, SUBTRACT or CONVERT :: at this point v_yy contains a 4 digit year "1"Įcho CALL DateMath YYYY MM DD - YYYY2 MM2 DD2Įcho Will set variable _dd_int to the signed differenceĮcho between the 2 dates (measured in days)Įcho Will set the following variables to the result ofĮcho adding or substracting days from the initial date:Įcho _yy_int is in YYYY format, even if YY format was originally supplied. ![]() "01"Įcho 'int' variables leading zeros are stripped e.g. :: If DateMath detects an error, variable _dd_int is set to 999999.Įcho DateMath will set the variables as listed belowĮcho 'str' variables include leading zeros e.g. :: DateMath, a general purpose date math routine ![]() How-to: Add or subtract days from any date - DateMath.cmdĬopy the script below or download here and save as DateMath.cmd off ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |