Julian Day Calculator with AutoIT

I know that there is a Julian Day Converter that has been around for years. It, however, is no longer supported. The window can sometimes be a little messy to resize and it is expressed by dd/mm/yyyy not mm/dd/yyyy for which I am more used to. Well, here is my attempt at a calculator using AutoIt and Koda.

This calculator is for all AD dates in the Gregorian calendar.

jdc

To use, type in the month, day, and year and press calculate. Done.

; Sources
; http://www.youtube.com/watch?v=Q2mizrHytuU
; http://csc.sesi-va.com/viewtopic.php?f=11&t=540
; http://scienceworld.wolfram.com/astronomy/JulianDate.html
; http://www.autoitscript.com/autoit3/docs/functions/Int.htm

#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>

#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Julian Day Calculator", 434, 86, 231, 126)
$Month = GUICtrlCreateInput("Month", 32, 16, 41, 21)
$Day = GUICtrlCreateInput("Day", 80, 16, 41, 21)
$Year = GUICtrlCreateInput("Year", 128, 16, 41, 21)
$Julian_Day = GUICtrlCreateInput("", 280, 16, 121, 21)
$Modified_Julian_Day = GUICtrlCreateInput("", 280, 48, 121, 21)
$Calculate = GUICtrlCreateButton("Calculate", 32, 48, 75, 25, 0)
$Label1 = GUICtrlCreateLabel("Julian Day", 224, 16, 53, 17)
$Label2 = GUICtrlCreateLabel("Modified Julian Day", 184, 48, 96, 17)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit

Case $Calculate
Switch GUICtrlRead($Month)
Case ''
Case Else
EndSwitch

Switch GUICtrlRead($Day)
Case ''
Case Else
EndSwitch

Switch GUICtrlRead($Year)
Case ''
Case Else
EndSwitch

; For Gregorian calendar dates 1901-2099
;$jd = (Int(367*GUICtrlRead($Year)-Int(7*(GUICtrlRead($Year)+Int((GUICtrlRead($Month)+9)/12))/4)+Int((275*GUICtrlRead($Month))/9)+GUICtrlRead($Day)+1721013.5)+1) ;JD=INT(367Y - INT(7(Y + INT((M+9)/12))/4) + INT(275M/9) + D + 1721013.5 ) + 1

; For all AD dates in the Gregorian calendar.
$jd = (Int(367*GUICtrlRead($Year)-Int(7*(GUICtrlRead($Year)+Int((GUICtrlRead($Month)+9)/12))/4) -Int(3*(Int((GUICtrlRead($Year)+(GUICtrlRead($Month)-9)/7)/100)+1)/4)  +Int((275*GUICtrlRead($Month))/9)+GUICtrlRead($Day)+1721028.5)+1)
$mjd = ($jd - 2400001) ;mjd = jd - 2400001

GUICtrlSetData(6, string($jd))
GUICtrlSetData(7, string($mjd))
EndSwitch
WEnd

Sources
Referenced in the code.