DIM Z Z = MDY (9,11,2001) PRINT "A day that will live in infamy: ", TODAY\$ (Z) FUNCTION MDY ( Month, Day, Year ) ' *********************************** ' Takes a Month, Day,Year arguments ' and returns the Julian Date ' *********************************** LOCAL Temp, JulPart Temp = ( Month-14 ) / 12 JulPart = Day - 32075 + ( 1461 *( Year + 4800 + Temp )/4) JulPart = JulPart + (367 * ( Month - 2 - Temp * 12) / 12) FUNCTION = JulPart - (3 * (( Year + 4900 + Temp) / 100) / 4) END FUNCTION FUNCTION TODAY\$ (Arg) ' ************************************** ' converts a Julian number into a ' computational date ("MM-DD-[-]YYYY") ' ************************************** LOCAL Juli, Day, Month, Year LOCAL Help, TempYear, TempMonth LOCAL szToday\$, szYear\$, szMonth\$ ' ************************************** Juli = Arg INCR Juli,68569 Help = 4 * Juli/146097 DECR Juli,(146097 * Help+3)/4 TempYear = 4000*(Juli + 1)/1461001 DECR Juli,1461 * TempYear / 4 INCR Juli,31 TempMonth = 80 * Juli / 2447 Day = Juli - ( 2447 * TempMonth / 80) Month = TempMonth + 2 - (12 * (TempMonth/11)) Year = 100 * (Help - 49) + TempYear + (TempMonth/11) szToday\$ = LTRIM\$(STR\$(Day)) szMonth\$ = LTRIM\$(STR\$(Month)) szYear\$ = LTRIM\$(STR\$(Year)) IF LEN(szToday\$) < 2 THEN szToday\$ = "0" & szToday\$ IF LEN(szMonth\$) < 2 THEN szMonth\$ = "0" & szMonth\$ FUNCTION = szMonth\$ & "-" & szToday\$ & "-" & szYear\$ END FUNCTION