endlesslove_1998

Calculate the numbers of months with a given day.

Dec 26th, 2014
249
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
AutoIt 0.42 KB | None | 0 0
  1. #include <Date.au3>
  2.  
  3. Local $iDaysToCalculate = 100
  4.  
  5. ; Convert day to date
  6. Local $iYear, $iMonth, $iDay
  7. _DayValueToDate(_DateToDayValue(@YEAR, 1, 1) + $iDaysToCalculate, $iYear, $iMonth, $iDay)
  8. ConsoleWrite($iYear & "/" & $iMonth & "/" & $iDay & @CRLF)
  9.  
  10. ; Get the months
  11. Local $iCalculatedMonth = _DateDiff("M", @YEAR & "/01/01", $iYear & "/" & $iMonth & "/" & $iDay)
  12. ConsoleWrite($iCalculatedMonth & " months." & @CRLF)
Advertisement
Add Comment
Please, Sign In to add comment