1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649 1650 1651 1652 1653 1654 1655 1656 1657 1658 1659 1660 1661 1662 1663 1664 1665 1666 1667 1668 1669 1670 1671 1672 1673 1674 1675 1676 1677 1678 1679 1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 1691 1692 1693 1694 1695 1696 1697 1698 1699 1700 1701 1702 1703 1704 1705 1706 1707 1708 1709 1710 1711 1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 1723 1724 1725 1726 1727 1728 1729 1730 1731 1732 1733 1734 1735 1736 1737 1738 1739 1740 1741 1742 1743 1744 1745 1746 1747 1748 1749 1750 1751 1752 1753 1754 1755 1756 1757 1758 1759 1760 1761 1762 1763 1764 1765 1766 1767 1768 1769 1770 1771 1772 1773 1774 1775 1776 1777 1778 1779 1780 1781 1782 1783 1784 1785 1786 1787 1788 1789 1790 1791 1792 1793 1794 1795 1796 1797 1798 1799 1800 1801 1802 1803 1804 1805 1806 1807 1808 1809 1810 1811 1812 1813 1814 1815 1816 1817 1818 1819 1820 1821 1822 1823 1824 1825 1826 1827 1828 1829 1830 1831 1832 1833 1834 1835 1836 1837 1838 1839 1840 1841 1842 1843 1844 1845 1846 1847 1848 1849 1850 1851 1852 1853 1854 1855 1856 1857 1858 1859 1860 1861 1862 1863 1864 1865 1866 1867 1868 1869 1870 1871 1872 1873 1874 1875 1876 1877 1878 1879 1880 1881 1882 1883 1884 1885 1886 1887 1888 1889 1890 1891 1892 1893 1894 1895 1896 1897 1898 1899 1900 1901 1902 1903 1904 1905 1906 1907 1908 1909 1910 1911 1912 1913 1914 1915 1916 1917 1918 1919 1920 1921 1922 1923 1924 1925 1926 1927 1928 1929 1930 1931 1932 1933 1934 1935 1936 1937 1938 1939 1940 1941 1942 1943 1944 1945 1946 1947 1948 1949 1950 1951 1952 1953 1954 1955 1956 1957 1958 1959 1960 1961 1962 1963 1964 1965 1966 1967 1968 1969 1970 1971 1972 1973 1974 1975 1976 1977 1978 1979 1980 1981 1982 1983 1984 1985 1986 1987 1988 1989 1990 1991 1992 1993 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 2019 2020 2021 2022 2023 2024 2025 2026 2027 2028 2029 2030 2031 2032 2033 2034 2035 2036 2037 2038 2039 2040 2041 2042 2043 2044 2045 2046 2047 2048 2049 2050 2051 2052 2053 2054 2055 2056 2057 2058 2059 2060 2061 2062 2063 2064 2065 2066 2067 2068 2069 2070 2071 2072 2073 2074 2075 2076 2077 2078 2079 2080 2081 2082 2083 2084 2085 2086 2087 2088 2089 2090 2091 2092 2093 2094 2095 2096 2097 2098 2099 2100 2101 2102 2103 2104 2105 2106 2107 2108 2109 2110 2111 2112 2113 2114 2115 2116 2117 2118 2119 2120 2121 2122 2123 2124 2125 2126 2127 2128 2129 2130 2131 2132 2133 2134 2135 2136 2137 2138 2139 2140 2141 2142 2143 2144 2145 2146 2147 2148 2149 2150 2151 2152 2153 2154 2155 2156 2157 2158 2159 2160 2161 2162 2163 2164 2165 2166 2167 2168 2169 2170 2171 2172 2173 2174 2175 2176 2177 2178 2179 2180 2181 2182 2183 2184 2185 2186 2187 2188 2189 2190 2191 2192 2193 2194 2195 2196 2197 2198 2199 2200 2201 2202 2203 2204 2205 2206 2207 2208 2209 2210 2211 2212 2213 2214 2215 2216 2217 2218 2219 2220 2221 2222 2223 2224 2225 2226 2227 2228 2229 2230 2231 2232 2233 2234 2235 2236 2237 2238 2239 2240 2241 2242 2243 2244 2245 2246 2247 2248 2249 2250 2251 2252 2253 2254 2255 2256 2257 2258 2259 2260 2261 2262 2263 2264 2265 2266 2267 2268 2269 2270 2271 2272 2273 2274 2275 2276 2277 2278 2279 2280 2281 2282 2283 2284 2285 2286 2287 2288 2289 2290 2291 2292 2293 2294 2295 2296 2297 2298 2299 2300 2301 2302 2303 2304 2305 2306 2307 2308 2309 2310 2311 2312 2313 2314 2315 2316 2317 2318 2319 2320 2321 2322 2323 2324 2325 2326 2327 2328 2329 2330 2331 2332 2333 2334 2335 2336 2337 2338 2339 2340 2341 2342 2343 2344 2345 2346 2347 2348 2349 2350 2351 2352 2353 2354 2355 2356 2357 2358 2359 2360 2361 2362 2363 2364 2365 2366 2367 2368 2369 2370 2371 2372 2373 2374 2375 2376 2377 2378 2379 2380 2381 2382 2383 2384 2385 2386 2387 2388 2389 2390 2391 2392 2393 2394 2395 2396 2397 2398 2399 2400 2401 2402 2403 2404 2405 2406 2407 2408 2409 2410 2411 2412 2413 2414 2415 2416 2417 2418 2419 2420 2421 2422 2423 2424 2425 2426 2427 2428 2429 2430 2431 2432 2433 2434 2435 2436 2437 2438 2439 2440 2441 2442 2443 2444 2445 2446 2447 2448 2449 2450 2451 2452 2453 2454 2455 2456 2457 2458 2459 2460 2461 2462 2463 2464 2465 2466 2467 2468 2469 2470 2471 2472 2473 2474 2475 2476 2477 2478 2479 2480 2481 2482 2483 2484 2485 2486 2487 2488 2489 2490 2491 2492 2493 2494 2495 2496 2497 2498 2499 2500 2501 2502 2503 2504 2505 2506 2507 2508 2509 2510 2511 2512 2513 2514 2515 2516 2517 2518 2519 2520 2521 2522 2523 2524 2525 2526 2527 2528 2529 2530 2531 2532 2533 2534 2535 2536 2537 2538 2539 2540 2541 2542 2543 2544 2545 2546 2547 2548 2549 2550 2551 2552 2553 2554 2555 2556 2557 2558 2559 2560 2561 2562 2563 2564 2565 2566 2567 2568 2569 2570 2571 2572 2573 2574 2575 2576 2577 2578 2579 2580 2581 2582 2583 2584 2585 2586 2587 2588 2589 2590 2591 2592 2593 2594 2595 2596 2597 2598 2599 2600 2601 2602 2603 2604 2605 2606 2607 2608 2609 2610 2611 2612 2613 2614 2615 2616 2617 2618 2619 2620 2621 2622 2623 2624 2625 2626 2627 2628 2629 2630 2631 2632 2633 2634 2635 2636 2637 2638 2639 2640 2641 2642 2643 2644 2645 2646 2647 2648 2649 2650 2651 2652 2653 2654 2655 2656 2657 2658 2659 2660 2661 2662 2663 2664 2665 2666 2667 2668 2669 2670 2671 2672 2673 2674 2675 2676 2677 2678 2679 2680 2681 2682 2683 2684 2685 2686 2687 2688 2689 2690 2691 2692 2693 2694 2695 2696 2697 2698 2699 2700 2701 2702 2703 2704 2705 2706 2707 2708 2709 2710 2711 2712 2713 2714 2715 2716 2717 2718 2719 2720 2721 2722 2723 2724 2725 2726 2727 2728 2729 2730 2731 2732 2733 2734 2735 2736 2737 2738 2739 2740 2741 2742 2743 2744 2745 2746 2747 2748 2749 2750 2751 2752 2753 2754 2755 2756 2757 2758 2759 2760 2761 2762 2763 2764 2765 2766 2767 2768 2769 2770 2771 2772 2773 2774 2775 2776 2777 2778 2779 2780 2781 2782 2783 2784 2785 2786 2787 2788 2789 2790 2791 2792 2793 2794 2795 2796 2797 2798 2799 2800 2801 2802 2803 2804 2805 2806 2807 2808 2809 2810 2811 2812 2813 2814 2815 2816 2817 2818 2819 2820 2821 2822 2823 2824 2825 2826 2827 2828 2829 2830 2831 2832 2833 2834 2835 2836 2837 2838 2839 2840 2841 2842 2843 2844 2845 2846 2847 2848 2849 2850 2851 2852 2853 2854 2855 2856 2857 2858 2859 2860 2861 2862 2863 2864 2865 2866 2867 2868 2869 2870 2871 2872 2873 2874 2875 2876 2877 2878 2879 2880 2881 2882 2883 2884 2885 2886 2887 2888 2889 2890 2891 2892 2893 2894 2895 2896 2897 2898 2899 2900 2901 2902 2903 2904 2905 2906 2907 2908 2909 2910 2911 2912 2913 2914 2915 2916 2917 2918 2919 2920 2921 2922 2923 2924 2925 2926 2927 2928 2929 2930 2931 2932 2933 2934 2935 2936 2937 2938 2939 2940 2941 2942 2943 2944 2945 2946 2947 2948 2949 2950 2951 2952 2953 2954 2955 2956 2957 2958 2959 2960 2961 2962 2963 2964 2965 2966 2967 2968 2969 2970 2971 2972 2973 2974 2975 2976 2977 2978 2979 2980 2981 2982 2983 2984 2985 2986 2987 2988 2989 2990 2991 2992 2993 2994 2995 2996 2997 2998 2999 3000 3001 3002 3003 3004 3005 3006 3007 3008 3009 3010 3011 3012 3013 3014 3015 3016 3017 3018 3019 3020 3021 3022 3023 3024 3025 3026 3027 3028 3029 3030 3031 3032 3033 3034 3035 3036 3037 3038 3039 3040 3041 3042 3043 3044 3045 3046 3047 3048 3049 3050 3051 3052 3053 3054 3055 3056 3057 3058 3059 3060 3061 3062 3063 3064 3065 3066 3067 3068 3069 3070 3071 3072 3073 3074 3075 3076 3077 3078 3079 3080 3081 3082 3083 3084 3085 3086 3087 3088 3089 3090 3091 3092 3093 3094 3095 3096 3097 3098 3099 3100 3101 3102 3103 3104 3105 3106 3107 3108 3109 3110 3111 3112 3113 3114 3115 3116 3117 3118 3119 3120 3121 3122 3123 3124 3125 3126 3127 3128 3129 3130 3131 3132 3133 3134 3135 3136 3137 3138 3139 3140 3141 3142 3143 3144 3145 3146 3147 3148 3149 3150 3151 3152 3153 3154 3155 3156 3157 3158 3159 3160 3161 3162 3163 3164 3165 3166 3167 3168 3169 3170 3171 3172 3173 3174 3175 3176 3177 3178 3179 3180 3181 3182 3183 3184 3185 3186 3187 3188 3189 3190 3191 3192 3193 3194 3195 3196 3197 3198 3199 3200 3201 3202 3203 3204 3205 3206 3207 3208 3209 3210 3211 3212 3213 3214 3215 3216 3217 3218 3219 3220 3221 3222 3223 3224 3225 3226 3227 3228 3229 3230 3231 3232 3233 3234 3235 3236 3237 3238 3239 3240 3241 3242 3243 3244 3245 3246 3247 3248 3249 3250 3251 3252 3253 3254 3255 3256 3257 3258 3259 3260 3261 3262 3263 3264 3265 3266 3267 3268 3269 3270 3271 3272 3273 3274 3275 3276 3277 3278 3279 3280 3281 3282 3283 3284 3285 3286 3287 3288 3289 3290 3291 3292 3293 3294 3295 3296 3297 3298 3299 3300 3301 3302 3303 3304 3305 3306 3307 3308 3309 3310 3311 3312 3313 3314 3315 3316 3317 3318 3319 3320 3321 3322 3323 3324 3325 3326 3327 3328 3329 3330 3331 3332 3333 3334 3335 3336 3337 3338 3339 3340 3341 3342 3343 3344 3345 3346 3347 3348 3349 3350 3351 3352 3353 3354 3355 3356 3357 3358 3359 3360 3361 3362 3363 3364 3365 3366 3367 3368 3369 3370 3371 3372 3373 3374 3375 3376 3377 3378 3379 3380 3381 3382 3383 3384 3385 3386 3387 3388 3389 3390 3391 3392 3393 3394 3395 3396 3397 3398 3399 3400 3401 3402 3403 3404 3405 3406 3407 3408 3409 3410 3411 3412 3413 3414 3415 3416 3417 3418 3419 3420 3421 3422 3423 3424 3425 3426 3427 3428 3429 3430 3431 3432 3433 3434 3435 3436 3437 3438 3439 3440 3441 3442 3443 3444 3445 3446 3447 3448 3449 3450 3451 3452 3453 3454 3455 3456 3457 3458 3459 3460 3461 3462 3463 3464 3465 3466 3467 3468 3469 3470 3471 3472 3473 3474 3475 3476 3477 3478 3479 3480 3481 3482 3483 3484 3485 3486 3487 3488 3489 3490 3491 3492 3493 3494 3495 3496 3497 3498 3499 3500 3501 3502 3503 3504 3505 3506 3507 3508 3509 3510 3511 3512 3513 3514 3515 3516 3517 3518 3519 3520 3521 3522 3523 3524 3525 3526 3527 3528 3529 3530 3531 3532 3533 3534 3535 3536 3537 3538 3539 3540 3541 3542 3543 3544 3545 3546 3547 3548 3549 3550 3551 3552 3553 3554 3555 3556 3557 3558 3559 3560 3561 3562 3563 3564 3565 3566 3567 3568 3569 3570 3571 3572 3573 3574 3575 3576 3577 3578 3579 3580 3581 3582 3583 3584 3585 3586 3587 3588 3589 3590 3591 3592 3593 3594 3595 3596 3597 3598 3599 3600 3601 3602 3603 3604 3605 3606 3607 3608 3609 3610 3611 3612 3613 3614 3615 3616 3617 3618 3619 3620 3621 3622 3623 3624 3625 3626 3627 3628 3629 3630 3631 3632 3633 3634 3635 3636 3637 3638 3639 3640 3641 3642 3643 3644 3645 3646
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<HTML>
<HEAD>
<TITLE>mxDateTime - Date/time types for Python</TITLE>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
<STYLE TYPE="text/css">
p { text-align: justify; }
ul.indent { }
body { }
</STYLE>
</HEAD>
<BODY TEXT="#000000" BGCOLOR="#FFFFFF" LINK="#0000EE" VLINK="#551A8B" ALINK="#FF0000">
<DIV CLASS="title">
<HR NOSHADE WIDTH="100%">
<H2>mxDateTime - Date and Time types for Python</H2>
<HR SIZE=1 NOSHADE WIDTH="100%">
<TABLE WIDTH="100%" CELLSPACING=4>
<TR>
<TD>
<SMALL>
<A HREF="#Interface">Interface</A> (
<A HREF="#DateTime">DateTime</A> :
<A HREF="#DateTimeDelta">DateTimeDelta</A> :
<A HREF="#RelativeDateTime">RelativeDateTime</A> :
<A HREF="#Constants">Constants</A> :
<A HREF="#Functions">Functions</A> ) :
<A HREF="#Arithmetic">Arithmetic</A> :
<A HREF="#Submodules">Submodules</A> (
<A HREF="#ISO">ISO</A> :
<A HREF="#ARPA">ARPA</A> :
<A HREF="#Feasts">Feasts</A> :
<A HREF="#Parser">Parser</A> :
<A HREF="#NIST">NIST</A> ) :
<A HREF="#Examples">Examples</A> :
<A HREF="#API">C API</A> :
<A HREF="#Structure">Structure</A> :
<A HREF="#Support">Support</A> :
<A HREF="http://www.egenix.com/files/python/eGenix-mx-Extensions.html#Download-mxBASE"><B>Download</B></A> :
<A HREF="#Copyright">Copyright & License</A> :
<A HREF="#History">History</A> :
<A HREF="" TARGET="_top">Home</A>
</SMALL>
</TD>
<TD ALIGN=RIGHT VALIGN=TOP>
<SMALL>
<FONT COLOR="#FF0000">Version 2.0.3</FONT>
</SMALL>
</TD>
</TABLE>
<HR SIZE=1 NOSHADE WIDTH="100%">
</DIV>
<H3>Introduction</H3>
<UL CLASS="indent">
<P>
These types were created to provide a consistent way of
transferring date and time data between Python and databases.
Apart from handling date before the Unix epoch (1.1.1970) they
also correctly work with dates beyond the Unix time limit
(currently with Unix time values being encoded using 32bit
integers, the limit is reached in 2038) and thus is <B>Year
2000</B> and <B>Year 2038</B> safe.
<P>
The primary absolute date/time type <B>DateTime</B> uses the
following internal format:
<P>
<DL>
<DT><B>Absolute date</B></DT>
<DD>
This is a C <TT>long</TT> defined as being the number of
days in the Gregorian calendar since the day before
January 1 in the year 1 (0001-01-01, the Christian Epoch
(CE)), thus the Gregorian date 0001-01-01 corresponds to
absolute date 1. Note that the Julian Epoch lies two days
before the Gregorian one. <P></DD>
<DT><B>Absolute time</B></DT>
<DD>
This is a C <TT>double</TT> defined as the number of
seconds since midnight (0:00:00.00) of the day expressed
by the above value.<P></DD>
</DL>
<P>
The <I>Epoch</I> used by the module is January 1st of the
year 1 at midnight (0:00:00.00) in the Gregorian
calendar. This date corresponds to absolute day 1 and
absolute time 0. Dates before the Epoch are handled by
extrapolating the calendars using negative years as basis
(the year 1 BCE corresponds to the year 0, 2 BCE is
represented as year -1 and so on).
<P>
For the purpose of storing absolute time differences, the
package provides a second type called
<B>DateTimeDelta</B>. The internal representation for this
type is seconds and stored in a signed C <TT>double</TT>.
<P>
To handle relative time deltas a third object type is
available: <B>RelativeDateTime</B>. This object is currently
implemented in Python and may be used to store relative time
deltas (see below for an exact description). It's main
purpose is providing an intuitive way to calculate e.g. the
"first of next month".
<P>
Designing the types wasn't as easy as expected, since many
criteria had to be taken into account. Here are some of them
and their implementation:
<H4>Time Zones, Daylight Savings Time (DST) and Leap Seconds</H4>
<P>
Time zones are among the most difficult to handle issues when it
comes to implementing and using types for date and time. We
chose to move the time zone handling functionality out of the C
implementation and into Python. This means that the types know
nothing about the time zones of the values they store and
calculations are done using the raw data.
<P>
If you need to store and use these informations in calculations,
you can "subclass" the types to implement your ideas rather than
having to stick to what the C implementation defines. The
included ODMG submodule is an example of how this can be done.
<P>
Leap seconds are not supported either. You can implement classes
respecting these by "subclassing" DateTime and DateTimeDelta and
then overriding the calculation methods with methods that work
on Unix ticks values (provided the underlying C lib knows about
leap seconds -- most don't and the POSIX standard even invorces
not to use leap seconds).
<H4>Calendars</H4>
<P>
The module supports two calendars, the Gregorian (default and
needed for most conversions) and the Julian, which is handy for
dates prior to the year 1582 when the calendar was revised by
Pope Gregory XIII.
<P>
Construction of Julian dates can be done using either the
<CODE>JulianDateTime()</CODE> constructor or indirect through
the <CODE>.Julian()</CODE> method of DateTime instances. To
check which calendar a DateTime instance uses, query the
<CODE>calendar</CODE> instance attribute.
<P>
Note that Julian dates output the Julian date through the
instances date attributes and broken down values. Not all
conversions are available on instances using the Julian
calendar. Even though in the Julian calendar days start at noon
(12:00:00.0), mxDateTime will use the Gregorian convention of
using the date for the period from 00:00:00.0 to 23:59:59.99 of
that day. (This may change in future versions, though.)
<P>
Both calendars use mathematical models as basis -- they do not
account for the many inaccuracies that occurred during their
usage history. For this reason, the <CODE>.absdate</CODE> values
should be interpreted with care, esp. for dates using the Julian
calendar. As a result of the mathematical models, the Epochs in
the calendars differ by a few days. This was needed in order to
synchronize the calendars in the switching year 1582 (I'm still
not 100% sure whether this is correct or not: JulianDate(1,1,1)
lies two days before Date(1,1,1)).
<P>
<H4>Conversion from and to other formats</H4>
<P>
For the purpose of converting the stored values to Unix ticks
(number of seconds since the Unix epoch; the C lib also uses
this representation) we assume that the values are given in
<B>local time</B>. This assumption had to be made because the C
lib provides no standard way to convert a broken down date/time
value in any other way into a ticks value.
<P>
Conversions to COM dates and tuples are done without any
assumption on the time zone. The raw values are used.
<P>
Conversion from other formats to DateTime instances is always
done by first calculating the corresponding absolute time and
date values (which are also used as basis for calculations).
<H4>Rounding errors</H4>
<P>
The internal representation of date/times behaves much like
floats do in Python, i.e. <I>rounding errors</I> can occur when
doing calculations. There is a special compare function included
(<CODE>cmp()</CODE>) in the package that allows you to compare
two date/time values using a given accuracy,
e.g. <CODE>cmp(date1,date2,0.5)</CODE> will allow 12:00:00.5 and
12:00:01.0 to compare equal.
<P>
Special care has been taken to prevent these rounding errors
from occurring for COM dates. If you create a DateTime instance
using a COM date, then the value returned by the .COMDate()
method is guaranteed to be exactly the same as the one used for
creation. The same is true for creation using absolute time and
absolute date and broken down values.
<H4>Immutability</H4>
<P>
One other thing to keep in mind when working with DateTime and
DateTimeDelta instances is that they are immutable (like
tuples). Once an instance is created you can not change its
value. Instead, you will have to create a new instance with
modified values. The advantage of having immutable objects is
that they can be used as dictionary keys.
<H4>UTC and GMT</H4>
<P>
UTC (Universal Time Code) and GMT (Greenich Mean Time) are two
names for more or less the same thing: they both refer to the
international universal time which is used throughout the world
to coordinate events in time regardeless of time zone, day light
savings time or other local time alterations. See the <A
HREF="http://www.tondering.dk/claus/calendar.html">Calendar FAQ</A> for
more infos.
<P>
The mx.DateTime package uses these two names interchangeably.
Sometimes API only refer to one name for simplicity. The name
preference (GMT or UTC) is often chosen according to common
usage.
<H4>Interaction with other types</H4>
<P>
DateTime and DateTimeDelta instances can be compared and hashed,
making them compatible to the dictionary implementation Python
uses (they can be used as keys). The copy protocol, simple
arithmetic and pickleing are also supported (ee below for
details).
<H4>String formats</H4>
<P>
DateTime and DateTimeDelta instances know how to output
themselves as ISO8601-strings. The format is very simple:
YYYY-MM-DD HH:MM:SS.ss for DateTime instances and
[-][DD:]HH:MM:SS.ss for DateTimeDelta instances (the DD-part
(days) is only given if the absolute delta value is greater than
24 hours). Customized conversion to strings can be done using
the <CODE>strftime</CODE>-methods or the included submodules.
<P>
String parsing is supported through the <CODE>strptime()</CODE>
constructor which implements a very strict parsing scheme and
the included submodules (e.g. <A HREF="#ISO">ISO</A> and <A
HREF="#ARPA">ARPA</A>), which allow a little more freedom.
<H4>Speed and Memory</H4>
<P>
Comparing the types to time-module based routines is not really
possible, since the used strategies differ. You can compare them
to tuple-based date/time classes though: DateTime[Delta] are
much faster on creation, use less storage and are faster to
convert to the supported other formats than any equivalent
tuple-based implementation written in Python.
<P>
Creation of time-module values using time.mktime() is much
slower than doing the same thing with DateTime(). The same holds
for the reverse conversion (using time.localtime()).
<P>
The storage size of ticks (floats, which the time module uses)
is about 1/3 of the size a DateTime instance uses. This is
mainly due to the fact that DateTime instances cache the broken
down values for fast access.
<P>
To summarize: DateTime[Delta] are faster, but also use more
memory than traditional time-module based techniques.
<P>
<H4>Background and Sources on the Web</H4>
<P>
Here is a small list of links I used as starting points to find
some of the date/time related information included in this
package:
<P>
<UL>
<LI>The <A
HREF="http://www.tondering.dk/claus/calendar.html">Calendar
FAQ</A> by Claus Tondering.
<LI>The <A
HREF="http://www.interlog.com/~r937/callinks.html">Calendar
Links</A> by Rudy Limeback.
<LI>The <A
HREF="http://www.smart.net/~mmontes/ec-cal.html">Ecclesiastical
Calendar</A> by Marcos J. Montes.
<LI>The <A
HREF="http://tycho.usno.navy.mil/systime.html">Systems of
Time</A> page provided by the Time Service Dept., U.S. Naval
Observatory, Washington, DC.
<LI>The <A
HREF="http://genealogy.org/~scottlee/calconvert.cgi">Calendar
Conversion </A> page by Scott E. Lee.
<LI>For the interested reader, I also suggest <A
HREF="http://physics.nist.gov/time">A walk through time </A>
presented by the NIST Time and Frequency Division.
</UL>
<P>
</UL><!--CLASS="indent"-->
<A NAME="Interface">
<H3>Interface</H3>
<UL CLASS="indent">
<P>The package provides three data structures for working with date
and time values. These are:
<P>
<OL>
<LI><A HREF="#DateTime">DateTime</A> for referring to
absolute date/time values,
<LI><A HREF="#DateTimeDelta">DateTimeDelta</A> for date/time
spans and
<LI><A HREF="#RelativeDateTime">RelativeDateTime</A> for
representing variable date/time spans (these are the TABs of
date/time calculation)
</OL>
<A NAME="DateTime">
<H4>DateTime Constructors</H4>
<UL CLASS="indent">
<P>Several constructors are available in the module
<TT>DateTime</TT>. All of these return DateTime instances
using the Gregorian calendar except for JulienDateTime() which
returns instances using the Julian calendar.
<P><DL>
<DT><CODE><FONT COLOR="#000099">
DateTime(year,month=1,day=1,hour=0,minute=0,second=0.0)</FONT></CODE></DT>
<DD>
Constructs a DateTime instance from the given values.
<P>
Assumes that the date is given in the Gregorian calendar
(which it the one used in many countries today).
<P>
The entry for <CODE>day</CODE> can be negative to
indicate days counted in reverse order, that is the last
day becomes -1, the day before that -2, and so on,
e.g. <CODE>DateTime(1997,12,-2)</CODE> gives the
30.12.1997 (this is useful especially for months).
<P>
Note that although the above makes it look like this
function can handle keywords, it currently cannot.
<P></DD>
<DT><CODE><FONT COLOR="#000099">
GregorianDateTime(year,month=1,day=1,hour=0,minute=0,second=0.0)</FONT></CODE></DT>
<DD>
Is just another name binding for DateTime().<P></DD>
<DT><CODE><FONT COLOR="#000099">
JulianDateTime(year,month=1,day=1,
hour=0,minute=0,second=0.0)</FONT></CODE></DT>
<DD>
Constructs a DateTime instance from the given values
assuming they are given in the Julian calendar.
<P>
The instance will use the Julian calendar for all date
related methods and attributes.
<P>
Same comments as for DateTime().
<P></DD>
<DT><CODE><FONT COLOR="#000099">
JulianDate(year,month=1,day=1)</FONT></CODE></DT>
<DD>
Is just another name binding for JulianDateTime(). The
time part is set to 00:00:00.0.<P></DD>
<DT><CODE><FONT COLOR="#000099">
Timestamp(year,month,day,hour=0,minute=0,second=0.0)</FONT></CODE></DT>
<DD>
Is just another name binding for DateTime(). <P></DD>
<DT><CODE><FONT COLOR="#000099">
Date(year,month,day)</FONT></CODE></DT>
<DD>
Is just another name binding for DateTime(). The
time part is set to 00:00:00.0.<P></DD>
<DT><CODE><FONT COLOR="#000099">
GregorianDate(year,month,day)</FONT></CODE></DT>
<DD>
Is just another name binding for DateTime(). The
time part is set to 00:00:00.0.<P></DD>
<DT><CODE><FONT COLOR="#000099">
mktime(tuple)</FONT></CODE></DT>
<DD>
Same as the DateTime() constructor accept that the
interface used is compatible to the similar time.mktime()
API. tuple has to be a 9-tuple
(year,month,day,hour,minute,second,dow,doy,dst).
<P>
Note that the tuple elements
<CODE>dow</CODE>,<CODE>doy</CODE> and <CODE>dst</CODE>
are not used in any way.
<P>
You should only use this contructor for porting
applications from time module based functions to
DateTime. <P></DD>
<DT><CODE><FONT COLOR="#000099">
DateTimeFromAbsDateTime(absdate,abstime)</FONT></CODE></DT>
<DD>
Returns a new DateTime instance for the given absolute
date and time.
<P>
This interface can be used by classes written in Python
which implement other calendars than the Gregorian, for
example.<P></DD>
<DT><CODE><FONT COLOR="#000099">
localtime(ticks)</FONT></CODE></DT>
<DD>
Constructs a DateTime instance from the ticks value (this
is what <TT>time.time()</TT> returns; see the
<TT>time</TT> module for details).
<P>
The instance will hold the associated local
time. <P></DD>
<DT><CODE><FONT COLOR="#000099">
now()</FONT></CODE></DT>
<DD>
Returns a new DateTime instance reflecting the current
local time. <P></DD>
<DT><CODE><FONT COLOR="#000099">
gmt()</FONT></CODE></DT>
<DD>
Returns a new DateTime instance reflecting the current
GMT time. <P></DD>
<DT><CODE><FONT COLOR="#000099">
utc()</FONT></CODE></DT>
<DD>
Alias for gmt().<P></DD>
<DT><CODE><FONT COLOR="#000099">
gmtime(ticks=time.time())</FONT></CODE></DT>
<DD>
Constructs a DateTime instance from the ticks value (this
is what <TT>time.time()</TT> returns; see the
<TT>time</TT> module for details).
<P>
The instance will hold the associated UTC time. If
ticks is not given, the current time is
used. <CODE>gmticks()</CODE> is the inverse of this
function.<P></DD>
<DT><CODE><FONT COLOR="#000099">
utctime(ticks=time.time())</FONT></CODE></DT>
<DD>
Alias for <CODE>gmtime()</CODE>.<P></DD>
<DT><CODE><FONT COLOR="#000099">
today(hour=0,minute=0,second=0.0)</FONT></CODE></DT>
<DD>
Returns a DateTime instance for the current date (in local
time) at the given time (defaults to midnight). E.g.
today(14,00) is today at 1400 hours.<P></DD>
<DT><CODE><FONT COLOR="#000099">
DateTimeFromAbsDays(days)</FONT></CODE></DT>
<DD>
Constructs a DateTime instance from the days since the
(Christian) Epoch value. <P></DD>
<DT><CODE><FONT COLOR="#000099">
DateTimeFromCOMDate(comdate)</FONT></CODE></DT>
<DD>
Constructs a DateTime instance from the <I>COM date</I>
value.
<P>
This is used in the COM mechanism I'm told and repesents
the date/time difference between 30.12.1899 and the
represented date/time, with time being encoded as
fraction of a whole day, thus 0.5 corresponds to
12:00:00.00.
<P>
Special care is taken that the resulting instance's
method <CODE>COMDate()</CODE> returns exactly the same
value as the one used for constructing it -- even though
the internal representation is more accurate. <P></DD>
<DT><CODE><FONT COLOR="#000099">
strptime(string,format_string[,default])</FONT></CODE></DT>
<DD>
Parse the given string using the format string and
construct a DateTime instance from the found value.
<P>
If <CODE>default</CODE> is given (must be a DateTime
instance), it's entries are used as default
values. Otherwise, 0001-01-01 00:00:00.00 is used. An
<CODE>Error</CODE> is raised if the underlying C parsing
function <CODE>strptime()</CODE> fails.
<P>
Portability note: <CODE>default</CODE> does not work on
Solaris. You will have to reassemble the correct
DateTime instance yourself (knowing which parts the
<CODE>strptime()</CODE> function parsed) if you intend
to use default values. Solaris sets the defaults to
1900-01-01 00:00:00.00 and then overwrites them with the
parsed values.
<P>
Note: Since this C API is relatively new, you may not
have access to this constructor on your platform. For
further information on the format, please refer to the
Unix manpage (it is very similar to that of
<CODE>strftime()</CODE> which is documented in the
Python library reference for the time module).<P></DD>
<DT><CODE><FONT COLOR="#000099">
DateTimeFromMJD(mjd)</FONT></CODE></DT>
<DD>
Constructs a DateTime instance from the given <I>Modified
Julian Day</I> (MJD) value.
<P>
Since MJD values are given in UTC, the instance will
represent UTC. See the <A
HREF="http://www.tondering.dk/claus/calendar.html">Calendar
FAQ</A> for details.
<P>
<U>Note:</U> Usage of MJD notation is discouraged by the
International Astronomical Union (IAU). Use JDN instead.
<P></DD>
<DT><CODE><FONT COLOR="#000099">
DateTimeFromTJD(tjd,tjd_myriad=current_myriad)</FONT></CODE></DT>
<DD>
Constructs a DateTime instance from the given <I>Truncated
Julian Day</I> (TJD) value as used by NASA and the U.S. Naval
Observatory, that is TJD = (MJD - 40000) % 10000 or simply TJD =
MJD % 10000. Some sources define TJD = MJD - 40000 making it
non-periodic; this is not supported by this constructor.
<P>
tjd_myriad will default to the tjd_myriad current at
package import time, if not given. It refers to the
truncated part of the TDJ number. The current myriad
(245) started on 1995-10-10 00:00:00.00 UTC and will
last until 2023-02-24 23:59:59.99 UTC.
<P>
Since TJD values are always given in UTC, the instance
will represent UTC.
<P>
Please note that usage of TJD is depreciated because of
the information loss involved with truncating data: use
MJD or JDN instead.
<P></DD>
<DT><CODE><FONT COLOR="#000099">
DateTimeFromJDN(jdn)</FONT></CODE></DT>
<DD>
Constructs a DateTime instance from the given <I>Julian
Day Number</I> (JDN).
<P>
Since JDN values are given in UTC, the instance will
represent UTC. See the <A
HREF="http://www.tondering.dk/claus/calendar.html">Calendar
FAQ</A> for details. <P></DD>
<DT><CODE><FONT COLOR="#000099">
DateTimeFrom(*args,**kws)</FONT></CODE></DT>
<DD>
Constructs a DateTime instance from the arguments.
<P>
This constructor can parse strings, handle numeric
arguments and knows about the keywords
<CODE>year,month,day,hour,minute,second</CODE>.
<P>
It uses type inference to find out how to interpret the
arguments and makes use of the Parser module.
<P></DD>
<DT><CODE><FONT COLOR="#000099">
TimestampFrom(*args,**kws)</FONT></CODE></DT>
<DD>
Alias for DateTimeFrom().
<P></DD>
<DT><CODE><FONT COLOR="#000099">
DateFromTicks(ticks)</FONT></CODE></DT>
<DD>
Constructs a DateTime instance pointing to the local time
date at 00:00:00.00 (midnight) indicated by the given
ticks value. The time part is ignored.
<P></DD>
<DT><CODE><FONT COLOR="#000099">
TimestampFromTicks(ticks)</FONT></CODE></DT>
<DD>
Constructs a DateTime instance pointing to the local date
and time indicated by the given ticks value.
<P></DD>
</DL>
</UL><!--CLASS="indent"-->
<H4>DateTime Instance Methods</H4>
<UL CLASS="indent">
<P>A <TT>DateTime</TT> instance has the following
methods. Note that the calendar setting of the instance
effects all methods relying on date values.
<P><DL>
<DT><CODE><FONT COLOR="#000099">
tuple()</FONT></CODE></DT>
<DD>
Returns the instances value as <TT>time.localtime()</TT>
tuple.
<P>
DST is set assuming local time. It can also be -1,
meaning that the information is not available. <P></DD>
<DT><CODE><FONT COLOR="#000099">
absvalues()</FONT></CODE></DT>
<DD>
Returns the instances value as tuple <CODE>(absdate,
abstime)</CODE>.<P></DD>
<DT><CODE><FONT COLOR="#000099">
ticks(offset=0.0,dst=-1)</FONT></CODE></DT>
<DD>
Returns a float repesenting the instances value in ticks
(see above).
<P>
The conversion routine assumes that the stored date/time
value is given in <I>local time</I>.
<P>
The given value for DST is used by the conversion (0 =
DST off, 1 = DST on, -1 = unkown) and offset is
subtracted from the resulting value.
<P>
The method raises a <CODE>RangeError</CODE> exception if
the objects value does not fit into the system's ticks
range.
<P>
<U>Note:</U> On some platforms the C lib's mktime()
function that this method uses does not allow setting
DST to an arbitrary value. The module checks for this
and raises a <CODE>SystemError</CODE> in case setting
DST to 0 or 1 does not result in valid results.
<P></DD>
<DT><CODE><FONT COLOR="#000099">
gmticks(offset=0.0)</FONT></CODE></DT>
<DD>
Returns a float representing the instances value in ticks
(see above).
<P>
The conversion routine assumes that the stored date/time
value is given in <I>UTC time</I>. offset is subtracted
from the resulting value.
<P>
The method raises an <CODE>RangeError</CODE>
exception if the objects value does not fit into the
system's ticks range.
<P></DD>
<DT><CODE><FONT COLOR="#000099">
gmtoffset()</FONT></CODE></DT>
<DD>
Returns a DateTimeDelta instance representing the UTC
offset for the instance assuming that the stored values
refer to local time. This is also sometimes called
timezone.
<P>
The UTC offset is defined as: local time - UTC time,
e.g. it is negative in the US and positive in eastern
Europe and Asia.
<P></DD>
<DT><CODE><FONT COLOR="#000099">
gmtime()</FONT></CODE></DT>
<DD>
Assuming that the instance refers to local time, this method
returns new DateTime instance holding the corresponding
UTC value.
<P></DD>
<DT><CODE><FONT COLOR="#000099">
localtime()</FONT></CODE></DT>
<DD>
Assuming that the instance refers to UTC time, this method
returns new DateTime instance holding the corresponding
local time value.
<P></DD>
<DT><CODE><FONT COLOR="#000099">
COMDate()</FONT></CODE></DT>
<DD>
Returns a float float repesenting the instances value as
COM date (see above).<P></DD>
<DT><CODE><FONT COLOR="#000099">
strftime(format_string="%c")</FONT></CODE></DT>
<DD>
Format the instances value as indicated by the format
string.
<P>
This is the same function as the one in the
<TT>time</TT> module. For further information please
refer to the manpage or the Python reference
manual.
<P>
Note: <TT>strftime()</TT> and <TT>strptime()</TT> try to
be the inverse of each other. The output from
<TT>strftime()</TT> given to <TT>strptime()</TT>
together with the format string passed to
<TT>strftime()</TT> will in most cases give you a
DateTime instance referring to the same date and
time.
<P>
Time zone information is <I>not</I> available. Use the
instance variable <CODE>tz</CODE> instead. <P></DD>
<DT><CODE><FONT COLOR="#000099">
Format(format_string="%c")</FONT></CODE></DT>
<DD>
This is just an alias for strftime() to make the type
compatible to other date/time types.<P></DD>
<DT><CODE><FONT COLOR="#000099">
Gregorian()</FONT></CODE></DT>
<DD>
Returns a DateTime instance pointing to the same point in
time but using the Gregorian calendar.<P></DD>
<DT><CODE><FONT COLOR="#000099">
Julian()</FONT></CODE></DT>
<DD>
Returns a DateTime instance pointing to the same point in
time but using the Julian calendar.<P></DD>
</DL>
</UL><!--CLASS="indent"-->
<H4>DateTime Instance Variables</H4>
<UL CLASS="indent">
<P>
To make life easier, the instances also provide a more
direct interface to their stored values (these are all
read-only). Note that the calendar setting of the instance
effects all attributes referring to date values.
<P><DL>
<DT><CODE><FONT COLOR="#000099">
hour, minute, second</FONT></CODE></DT>
<DD>
Return the indicated values in their standard ranges.
<P>
Note that in a future release, leap seconds may also be
considered and thus second has a range of 0-60.<P></DD>
<DT><CODE><FONT COLOR="#000099">
year, month, day</FONT></CODE></DT>
<DD>
Return the indicated values in their standard 1-based
ranges.<P></DD>
<DT><CODE><FONT COLOR="#000099">
date, time</FONT></CODE></DT>
<DD>
Returns the ISO representation of the date part as
string. The format is [-]YYYY-MM-DD. <P></DD>
<DT><CODE><FONT COLOR="#000099">
time</FONT></CODE></DT>
<DD>
Returns the ISO representation of the time part as
string. The format is HH:MM:SS.ss with ss being the
truncated fraction of the seconds value. <P></DD>
<DT><CODE><FONT COLOR="#000099">
dst</FONT></CODE></DT>
<DD>
Integer indicating whether DST is active (1) or not (0) or
cannot be determined (-1).
<P>
The value is calculated assuming that the stored value
is local time. <P></DD>
<DT><CODE><FONT COLOR="#000099">
tz</FONT></CODE></DT>
<DD>
Returns the time zone string, assuming local time, or
"???" if the information is not available. <P></DD>
<DT><CODE><FONT COLOR="#000099">
day_of_week</FONT></CODE></DT>
<DD>
Returns the day of the week. Monday is returned as
0.<P></DD>
<DT><CODE><FONT COLOR="#000099">
day_of_year</FONT></CODE></DT>
<DD>
Returns the day of the year; 1.1. is returned as
1.<P></DD>
<DT><CODE><FONT COLOR="#000099">
days_in_month</FONT></CODE></DT>
<DD>
Returns the number of days in the object's month. <P></DD>
<DT><CODE><FONT COLOR="#000099">
iso_week</FONT></CODE></DT>
<DD>
Returns a tuple (year,isoweek,isoday) signifying the <A
HREF="http://www.cl.cam.ac.uk/~mgk25/iso-time.html">ISO
week notation</A> for the date the object points
to.
<P>
Note: isoday 1 is Monday !<P></DD>
<DT><CODE><FONT COLOR="#000099">
is_leapyear</FONT></CODE></DT>
<DD>
Returns 1 iff the instances value points to a leap year in
the Gregorian calendar.<P></DD>
<DT><CODE><FONT COLOR="#000099">
yearoffset</FONT></CODE></DT>
<DD>
Returns the absolute date of the 31.12. in the year before
the instance's year.<P></DD>
<DT><CODE><FONT COLOR="#000099">
absdays</FONT></CODE></DT>
<DD>
Returns the absolute date and time of the object converted
to a Python float representing absolute days (days since
the epoch).
<P>
The value is calculated using a 86400.0 seconds/day
basis and does not account for leap seconds. This value
is handy if you need the date/time value stored in one
number. By using a Python float, which is mapped to a C
double internally, the accuracy should give a fairly
large range of valid dates.<P></DD>
<DT><CODE><FONT COLOR="#000099">
absdate</FONT></CODE></DT>
<DD>
Returns the absolute date as used by the instance.<P></DD>
<DT><CODE><FONT COLOR="#000099">
abstime</FONT></CODE></DT>
<DD>
Returns the absolute time as used by the instance.<P></DD>
<DT><CODE><FONT COLOR="#000099">
mjd</FONT></CODE></DT>
<DD>
Returns a float representing the instance's value in terms
of <I>Modified Julian Days</I> (1858-11-17 00:00:00.00 UTC
being Modified Julian Day 0).
<P>
It is assumed for the calculation that the stored value
is given in UTC. Fractions indicate parts of the full
day, e.g. 0.5 referrs to noon on the 17 November
1858.
<P>
See the <A
HREF="http://www.tondering.dk/claus/calendar.html">Calendar
FAQ</A> or <A
HREF="http://tycho.usno.navy.mil/systime.html">Systems
of Time</A> for details.<P></DD>
<P>
<U>Note:</U> Usage of MJD notation is discouraged by the
International Astronomical Union (IAU). Use JDN instead.
<P>
<DT><CODE><FONT COLOR="#000099">
tjd</FONT></CODE></DT>
<DD>
Returns a float representing the instance's value in terms
of <I>Truncated Julian Days</I> (TJD).
<P>
TJDs are calculated using 00:00 UTC on 1 January 4713 BC
as epoch, counting the number of days as for the Julian
Day Numbers and then omitting the myriad part (div
10000) from it. As a result the TJD will always have at
most 4 digits. The divisor is available through the
<CODE>tjd_myriad</CODE> attribute.
<P>
It is assumed for the calculation that the stored value
is given in UTC. Fractions indicate parts of the full
day.
<P>
Some people claim that this term is also known under the
name <I>Star Date</I>. Remember ? ... <TT>"Captain's
Log, Star Date 8143.65"</TT>. I wonder which myriad
these dates refer to.
<P></DD>
<DT><CODE><FONT COLOR="#000099">
tjd_myriad</FONT></CODE></DT>
<DD>
Returns the truncated part of the TJD
representation.<P></DD>
<DT><CODE><FONT COLOR="#000099">
jdn</FONT></CODE></DT>
<DD>
Returns a float representing the instance's value as
<I>Julian Day Number</I> (Julian Day Number 0 starts at
12:00 UTC on 1 January 4713 BC and ends 24 hours later at
noon on 2 January 4713 BC).
<P>
It is assumed for the calculation that the stored value
is given in UTC. Fractions indicate parts of the full
day, e.g. JDN 2451170.17393 referrs to Tue, 22 Dec 1998
16:10:27 UTC.
<P>
See the <A
HREF="http://www.tondering.dk/claus/calendar.html">Calendar
FAQ</A> for details.<P></DD>
<DT><CODE><FONT COLOR="#000099">
calendar</FONT></CODE></DT>
<DD>
Calendar used by the instance. This can either be the
constant <CODE>Julian</CODE> or
<CODE>Gregorian</CODE>.<P></DD>
</DL>
</UL><!--CLASS="indent"-->
<A NAME="DateTimeDelta">
<H4>DateTimeDelta Constructors</H4>
<UL CLASS="indent">
<P>Several constructors are available:
<P><DL>
<DT><CODE><FONT COLOR="#000099">
DateTimeDelta(days[,hours=0.0,minutes=0.0,seconds=0.0])</FONT></CODE></DT>
<DD>
Returns a new DateTimeDelta instance for the given time
delta.
<P>
The internal value is calculated using the formula
<CODE>days*86400.0 + hours*3600.0 + minutes*60.0 +
seconds</CODE>. Keep this in mind when passing negative
values to the constructor. <P></DD>
<DT><CODE><FONT COLOR="#000099">
TimeDelta(hour=0.0,minute=0.0,second=0.0)</FONT></CODE></DT>
<DD>
Constructs a DateTimeDelta instance from the given values.
<P>
The internal value is calculated using the formula
<CODE>hours * 3600 + minutes * 60 + seconds</CODE>. Keep
this in mind when passing negative values to the
constructor.
<P>
The constructor allows usage of keywords,
e.g. Time(seconds=1.5) works. <P></DD>
<DT><CODE><FONT COLOR="#000099">
Time(hour,minute=0.0,second=0.0)</FONT></CODE></DT>
<DD>
Is just another name binding for TimeDelta.<P></DD>
<DT><CODE><FONT COLOR="#000099">
DateTimeDeltaFromSeconds(seconds)</FONT></CODE></DT>
<DD>
Constructs a DateTimeDelta instance from the given
<TT>seconds</TT> value. It can be given as float. <P></DD>
<DT><CODE><FONT COLOR="#000099">
DateTimeDeltaFromDays(days)</FONT></CODE></DT>
<DD>
Constructs a DateTimeDelta instance from the given
<TT>days</TT> value. It can be given as float.
<P>
The internal value is calculated using a 86400.0
seconds/day basis.<P></DD>
<DT><CODE><FONT COLOR="#000099">
DateTimeDeltaFrom(*args,**kws)</FONT></CODE></DT>
<DD>
Constructs a DateTimeDelta instance from the arguments.
<P>
This constructor can parser strings, handle numeric
arguments and knows about the keywords
<CODE>year,month,day,hour,minute,second</CODE>.
<P>
It uses type inference to find out how to interpret the
arguments and makes use of the Parser module.
<P></DD>
<DT><CODE><FONT COLOR="#000099">
TimeDeltaFrom(*args,**kws)</FONT></CODE></DT>
<DD>
Constructs a DateTimeDelta instance from the arguments.
<P>
The interface is the same as for DateTimeDeltaFrom()
with the exception that numeric arguments are
interpreted without day part as for the TimeDelta()
constructor.
<P></DD>
<DT><CODE><FONT COLOR="#000099">
TimeFrom(*args,**kws)</FONT></CODE></DT>
<DD>
Alias for TimeDeltaFrom().
<P></DD>
<DT><CODE><FONT COLOR="#000099">
TimeFromTicks(ticks)</FONT></CODE></DT>
<DD>
Constructs a DateTimeDelta instance pointing to the local
time indicated by the given ticks value. The date part is
ignored.
<P></DD>
</DL>
</UL><!--CLASS="indent"-->
<H4>DateTimeDelta Instance Methods</H4>
<UL CLASS="indent">
<P>A <TT>DateTimeDelta</TT> instance has the following methods:
<P><DL>
<DT><CODE><FONT COLOR="#000099">
absvalues()</FONT></CODE></DT>
<DD>
Return a <CODE>(absdays, absseconds)</CODE> tuple.
<P>
The <CODE>absseconds</CODE> part is normalized in such
way that it is always smaller than 86400.0. Both values
are signed.<P></DD>
<DT><CODE><FONT COLOR="#000099">
tuple()</FONT></CODE></DT>
<DD>
Returns the instance's value as
<TT>(day,hour,minute,second)</TT> tuple.
<P>
The values are the same those returned by the attributes
of the same name. <P></DD>
<DT><CODE><FONT COLOR="#000099">
strftime(format_string)</FONT></CODE></DT>
<DD>
Format the instance's value as indicated by the format
string.
<P>
This is the same function as the one in the
<TT>time</TT> module. For further information please
refer to the manpage or the Python reference
manual.
<P>
Since some descriptors don't make any sense for
date/time deltas these return undefined values. Only the
fields hour, minute, seconds and day are set according
to the objects value (the descriptors <CODE>%d %H %M %S
%I %p %X</CODE> work as expected).
<P>
Negative values show up positive -- you'll have to
provide your own way of showing the sign (the
<CODE>seconds</CODE> instance variable is signed).
<P></DD>
</DL>
</UL><!--CLASS="indent"-->
<H4>DateTimeDelta Instance Variables</H4>
<UL CLASS="indent">
<P>
To make life easier, the instances also provide a more
direct interface to their stored values (these are all
read-only):
<P><DL>
<DT><CODE><FONT COLOR="#000099">
day, hour, minute, second</FONT></CODE></DT>
<DD>
Return the indicated values in their standard ranges. The
values are negative for negative time deltas.<P></DD>
<DT><CODE><FONT COLOR="#000099">
days, hours, minutes, seconds</FONT></CODE></DT>
<DD>
Return the internal value of the object expressed as float
in the resp. units, e.g. <CODE>TimeDelta(12,00,00).days ==
0.5</CODE>.<P></DD>
</DL>
<P>
</UL><!--CLASS="indent"-->
<A NAME="RelativeDateTime">
<H4>RelativeDateTime Constructors</H4>
<UL CLASS="indent">
<P>These constructors are avaiable:
<P><DL>
<DT><CODE><FONT COLOR="#000099">
RelativeDateTime(years=0,months=0,days=0,
year=0,month=0,day=0,
hours=0,minutes=0,seconds=0,
hour=None,minute=None,second=None,
weekday=None,weeks=0)</FONT></CODE></DT>
<DD>
Returns a RelativeDateTime instance for the specified
relative time.
<P>
The constructor handles keywords, so you'll only have to
give those parameters which should be changed when you
add the relative to an absolute DateTime instance.
<P>
Do not pass arguments directly, always use the keyword
notation !
<P>
Absolute values passed to the constructor will override
delta values of the same type. Note that
<CODE>weeks</CODE> is added to <CODE>days</CODE> so that
the instances days values will be <CODE>days +
7*weeks</CODE>.
<P>
weekday must be a 2-tuple if given: (day_of_week,
nth). The value is applied after all other calculations
have been done resulting in moving the date to the nth
weekday in the month that the date points to. Negative
values for nth result in the ordering of the month's
weekdays to be reversed, e.g. (Monday,-1) will move to
the last Monday in that month. Setting nth to 0 results
in the date's week to be used as reference, e.g
(Tuesday,0) will move to Tuesday that week (which could
lie in a different month). weekday is considered an
absolute value, so multiplication or negation will not
touch it.
<P></DD>
<DT><CODE><FONT COLOR="#000099">
RelativeDate(years=0,months=0,days=0,
year=0,month=0,day=0,
weeks=0)
</FONT></CODE></DT>
<DD>
Is another name binding for RelativeDateTime. Do not pass
arguments directly, always use the keyword notation !
<P></DD>
<DT><CODE><FONT COLOR="#000099">
RelativeDateTimeFrom(*args,**kws)</FONT></CODE></DT>
<DD>
Constructs a RelativeDateTime instance from the arguments.
<P>
This constructor can parse strings, handle numeric
arguments and knows about the same keywords as the
<CODE>RelativeDateTime()</CODE> constructor.
<P>
It uses type inference to find out how to interpret the
arguments and makes use of the Parser module.
<P></DD>
<DT><CODE><FONT COLOR="#000099">
RelativeDateFrom(*args,**kws)
</FONT></CODE></DT>
<DD>
Is another name binding for <CODE>RelativeDateTime()</CODE>.
<P>
Note that in future versions this constructor may explicitly
ignore the time parts.
<P></DD>
<DT><CODE><FONT COLOR="#000099">
RelativeTimeFrom(*args,**kws)
</FONT></CODE></DT>
<DD>
Is another name binding for <CODE>RelativeDateTime()</CODE>.
<P>
Note that in future versions this constructor may explicitly
ignore the date parts.
<P></DD>
<DT><CODE><FONT COLOR="#000099">
RelativeDateTimeDiff(date1,date2)
</FONT></CODE></DT>
<DD>
Returns a RelativeDateTime instance representing the
difference between date1 and date2 in relative terms.
The following should hold: <CODE>date2 +
RelativeDateDiff(date1,date2) == date1</CODE>
for all dates date1 and date2.
<P>
Note that due to the algorithm used by this function,
not the whole range of DateTime instances is supported;
there could also be a loss of precision
<P>
This constructor is still <I>experimental</I>. It is not
fully debugged yet.
<P></DD>
<DT><CODE><FONT COLOR="#000099">
RelativeDateDiff(date1,date2)
</FONT></CODE></DT>
<DD>
Is another name binding for <CODE>RelativeDateTimeDiff()</CODE>.
<P></DD>
<DT><CODE><FONT COLOR="#000099">
Age(date1,date2)
</FONT></CODE></DT>
<DD>
Is another name binding for <CODE>RelativeDateTimeDiff()</CODE>.
<P></DD>
</DL>
<P>
RelativeDateTime objects store the given settings (plural
nouns meaning deltas, singular nouns absolute values) and
apply them when used in calculations. Delta values will have
the effect of changing the corresponding attribute of the
involved absolute DateTime object accordingly, while
absolute values overwrite the DateTime objects attribute
value with a new one. The effective value of the object is
thus determined at calculation time and depends on the
context it is used in.
<P>
Adding and subtracting RelativeDateTime instances is
supported with the following rules: deltas will be added
together and right side absolute values override left side
ones.
<P>
Multiplying RelativeDateTime instances with numbers will
yield instances with scaled deltas (absolute values are not
effected).
<P>
Adding RelativeDateTime instances to and subtracting
RelativeDateTime instances from DateTime instances will
return DateTime instances with the appropriate calculations
applied, e.g. to get a DateTime instance for the first of
next month, you'd call <CODE>now() +
RelativeDateTime(months=+1, day=01)</CODE>.
<P>
<U>Note</U> that dates like <CODE>Date(1999,1,30) +
RelativeDateTime(months=+1)</CODE> are not supported. The
package currently interprets these constructions as
<CODE>Date(1999,2,1) + 30</CODE>, thus giving the 1999-03-02
which may not be what you'd expect.
<P>
When providing both delta and absolute values for an entity
the absolute value is set first and then the delta applied
to the outcome.
<P>
In tests, RelativeDateTime instances are false in case they
do not define any date or time alterations and true
otherwise.
<P>
A few examples will probably make the intended usage
clearer:
<FONT COLOR="#000066">
<PRE>>>> from mx.DateTime import *
>>> print now()
1998-08-11 16:46:02.20
# add one month
>>> print now() + RelativeDateTime(months=+1)
1998-09-11 16:46:24.59
# add ten months
>>> print now() + RelativeDateTime(months=+10)
1999-06-11 16:47:03.07
# ten days from now
>>> print now() + RelativeDateTime(days=+10)
1998-08-21 16:47:10.58
# first of next month
>>> print now() + RelativeDateTime(months=+1,day=1)
1998-09-01 16:47:25.15
# first of this month, same time
>>> print now() + RelativeDateTime(day=1)
1998-08-01 16:47:35.48
# first of this month at midnight
>>> print now() + RelativeDateTime(day=1,hour=0,minute=0,second=0)
1998-08-01 00:00:00.00
# next year, first of previous month, same time
>>> print now() + RelativeDateTime(years=+1,months=-1,day=1)
1999-07-01 16:48:31.87
# Last Sunday in October 1998
>>> print Date(1998) + RelativeDateTime(weekday=(Sunday,-1),month=10)
1998-10-25 00:00:00.00
# The result in ARPA notation:
>>> print ARPA.str(Date(1998) + RelativeDateTime(weekday=(Sunday,-1),month=10))
Sun, 25 Oct 1998 00:00:00 +0200
# Generic way of specifying "next tuesday":
>>> NextTuesday = RelativeDateTime(days=+6,weekday=(Tuesday,0))
</PRE></FONT>
</UL><!--CLASS="indent"-->
<H4>RelativeDateTime Instance Methods</H4>
<UL CLASS="indent">
<P><TT>RelativeDateTime</TT> instances currently don't have
any instance methods.
</UL><!--CLASS="indent"-->
<H4>RelativeDateTime Instance Variables</H4>
<UL CLASS="indent">
<P>
The following attributes are exposed, but should not be
written to directly (the objects are currently implemented
in Python, but that could change in future releases).
<P><DL>
<DT><CODE><FONT COLOR="#000099">
year, month, day, hour, minute, second, weekday</FONT></CODE></DT>
<DD>
Absolute values of the instance.<P></DD>
<DT><CODE><FONT COLOR="#000099">
years, months, days, hours, minutes, seconds</FONT></CODE></DT>
<DD>
Relative values of the instance.<P></DD>
</DL>
<P>
The given values are only defined in case they were set at
instance creation time.
</UL><!--CLASS="indent"-->
<A NAME="Constants">
<H4>Constants</H4>
<UL CLASS="indent">
<P>The package defines these constants:
<P><DL>
<DT><CODE><FONT COLOR="#000099">
oneWeek, oneDay, oneHour, oneMinute, oneSecond</FONT></CODE></DT>
<DD>
Are set to the indicated values wrapped into DateTimeDelta
instances. <P></DD>
<DT><CODE><FONT COLOR="#000099">
Error, RangeError</FONT></CODE></DT>
<DD>
These are the exception objects. Exceptions will normally
only be raised by functions, methods or arithmetic
operations. RangeError is a subclass of Error. <P></DD>
<DT><CODE><FONT COLOR="#000099">
DateTimeType, DateTimeDeltaType</FONT></CODE></DT>
<DD>
The type objects for the two types. <P></DD>
<DT><CODE><FONT COLOR="#000099">
Epoch</FONT></CODE></DT>
<DD>
A DateTime instance pointing to the Christian Epoch, i.e.
0001-01-01 00:00:00.00.<P></DD>
<DT><CODE><FONT COLOR="#000099">
mxDateTimeAPI</FONT></CODE></DT>
<DD>
The C API wrapped by a C object. See mxDateTime.h for
details. <P></DD>
<DT><CODE><FONT COLOR="#000099">
MaxDateTime, MinDateTime, MaxDateTimeDelta,
MinDateTimeDelta</FONT></CODE></DT>
<DD>
These constants define the accepted ranges for the basic
types. The values depend on the ranges of C <TT>longs</TT>
on your platform. <P></DD>
<DT><CODE><FONT COLOR="#000099">
Monday, Tuesday, Wednesday,
Thursday, Friday, Saturday, Sunday </FONT></CODE></DT>
<DD>
Weekdays encoded as integers. Monday maps to 0, Tuesday to 1
and so on. <P></DD>
<DT><CODE><FONT COLOR="#000099">
Weekday </FONT></CODE></DT>
<DD>
Mapping that maps weekdays to integers and integers to
weekdays. Monday maps to 0, Tuesday to 1 and so
on. <P></DD>
<DT><CODE><FONT COLOR="#000099">
January, February, March,
April, May, June, July, August, September, October,
November, December </FONT></CODE></DT>
<DD>
Months encoded as integers. January maps to 1, February to
2 and so on. <P></DD>
<DT><CODE><FONT COLOR="#000099">
Month </FONT></CODE></DT>
<DD>
Mapping that maps months to integers and integers to
months. January maps to 1, February to 2 and so
on. <P></DD>
<DT><CODE><FONT COLOR="#000099">
Gregorian, Julian </FONT></CODE></DT>
<DD>
The objects returned by <CODE>calendar</CODE> attribute of
DateTime objects. Currently these are the strings
'Gregorian' and 'Julian', but this mught change in future
versions: always use these objects for checking the
calendar type.<P></DD>
<DT><CODE><FONT COLOR="#000099">
POSIX </FONT></CODE></DT>
<DD>
Constant stating the POSIX compatibility of the system w/r
to Unix ticks.
<P>
If the system's time package uses POSIX time_t values
(without counting leap seconds), it is set to 1. In case
the system's ticks values include leap seconds and thus
correctly represent the term "seconds since the epoch",
the constant is set to 0.
<P></DD>
</DL>
</UL><!--CLASS="indent"-->
<A NAME="Functions">
<H4>Helper functions</H4>
<UL CLASS="indent">
<P>The package defines these additional functions:
<P><DL>
<DT><CODE><FONT COLOR="#000099">
cmp(obj1,obj2,accuracy=0.0)</FONT></CODE></DT>
<DD>
Compares two DateTime[Delta] objects.
<P>
If accuracy is given, then equality will result in case
the absolute difference between the two values is less
than or equal to accuracy. <P></DD>
<DT><CODE><FONT COLOR="#000099">
gmticks(datetime)</FONT></CODE></DT>
<DD>
Returns a ticks value for datetime assuming the stored
value is given in UTC.
<P>
DEPRECIATED: Use the .gmticks() method instead.
<P></DD>
<DT><CODE><FONT COLOR="#000099">
utcticks(datetime)</FONT></CODE></DT>
<DD>
Alias for <CODE>gmticks()</CODE>.
<P>
DEPRECIATED: Use the .gmticks() method instead.
<P></DD>
<DT><CODE><FONT COLOR="#000099">
tz_offset(datetime)</FONT></CODE></DT>
<DD>
Returns a DateTimeDelta instance representing the UTC
offset for datetime assuming that the stored values refer
to local time. If you subtract this value from datetime,
you'll get UTC time.
<P>
DEPRECIATED: Use the .gmtoffset() method instead.
<P></DD>
<DT><CODE><FONT COLOR="#000099">
gm2local(datetime)</FONT></CODE></DT>
<DD>
Convert a DateTime instance holding UTC time to a DateTime
instance using local time.
<P></DD>
<DT><CODE><FONT COLOR="#000099">
utc2local(datetime)</FONT></CODE></DT>
<DD>
Alias for <CODE>gm2local()</CODE>.<P></DD>
<DT><CODE><FONT COLOR="#000099">
local2gm(datetime)</FONT></CODE></DT>
<DD>
Convert a DateTime instance holding local time to a
DateTime instance using UTC time.<P></DD>
<DT><CODE><FONT COLOR="#000099">
local2utc(datetime)</FONT></CODE></DT>
<DD>
Alias for <CODE>local2gm()</CODE>.<P></DD>
</DL>
</UL><!--CLASS="indent"-->
<P>If you find any bugs, please report them to <A
HREF="mailto:mal@lemburg.com?subject=mxDateTime">me</A> so that I
can fix them for the next release.
<P>
</UL><!--CLASS="indent"-->
<A NAME="Arithmetic">
<H3>Date/Time Arithmetic</H3>
<UL CLASS="indent">
<P>
The three objects DateTime, DateTimeDelta and
RelativeDateTime can be used to do simple date/time
arithmetic. Addition and subtraction are supported and
result in the expected results. In addition to handling
arithmetic using only the two types, mixed arithmetic with
numbers is also understood to a certain extent:
<P>
<TABLE BORDER=0 CELLSPACING=1 CELLPADDING=5 BGCOLOR="#F3F3F3">
<TR BGCOLOR="#D6D6D6">
<TD NOSAVE><B>Argument 1</B></TD>
<TD><B>Argument 2</B></TD>
<TD NOSAVE><B>Result</B></TD>
</TR>
<TR VALIGN=TOP NOSAVE>
<TD NOSAVE>DateTime object v</TD>
<TD NOSAVE>DateTime object w</TD>
<TD>
<DL>
<DT><CODE>v - w</CODE> <DD>returns a DateTimeDelta
object representing the time difference;
<DT><CODE>v + w</CODE> <DD>is not defined.
</DL>
</TD>
</TR>
<TR VALIGN=TOP NOSAVE>
<TD NOSAVE>DateTime object v</TD>
<TD NOSAVE>A number w</TD>
<TD>
<DL>
<DT><CODE>v - w</CODE> <DD> returns a new DateTime
object with a date/time decremented by <CODE>w</CODE>
<B>days</B> (floats can be used to indicate day
fractions);
<DT><CODE>v + w</CODE> <DD>works accordingly;<BR>
Note: you can use the object oneDay to get similar
effects in a more intuitive way.
<DT><CODE>v cmp w</CODE> <DD>Converts <CODE>v</CODE>
to Unix ticks and returns the result of comparing the
ticks value to the number <CODE>w</CODE>. Note: the
ticks conversion assumes that the stored value is
given in local time. Also note that the comparison will
only yield correct results if the DateTime instance is
placed on the <I>left</I> of the comparison operator
(this is because of the coercion quirks mentioned
below).
</DL>
</TD>
</TR>
<TR VALIGN=TOP NOSAVE>
<TD NOSAVE>DateTime object v</TD>
<TD NOSAVE>DateTimeDelta object w</TD>
<TD>
<DL>
<DT><CODE>v - w</CODE> <DD>returns a new DateTimeDelta
object with a date/time decremented by
<CODE>w</CODE>'s value;
<DT><CODE>v + w</CODE> <DD>works accordingly.
</DL>
</TD>
</TR>
<TR VALIGN=TOP NOSAVE>
<TD NOSAVE>DateTime object v</TD>
<TD NOSAVE>RelativeDateTime object w</TD>
<TD>
<DL>
<DT><CODE>v + w</CODE> <DD>returns a new DateTime
object with a date/time adjusted according to
<CODE>w</CODE>'s settings;
<DT><CODE>v - w</CODE> <DD>works accordingly.
</DL>
</TD>
</TR>
<TR VALIGN=TOP NOSAVE>
<TD NOSAVE>RelativeDateTime object v</TD>
<TD NOSAVE>A number w</TD>
<TD>
<DL>
<DT><CODE>v * w</CODE> <DD>returns a new
RelativeDateTime object with all deltas multiplied by
<CODE>float(w)</CODE> (<CODE>w * v</CODE> works in the
same way);
<DT><CODE>v / w</CODE> <DD>returns a new
RelativeDateTime object with all deltas divided by
<CODE>float(w)</CODE>;
</DL>
</TD>
</TR>
<TR VALIGN=TOP NOSAVE>
<TD NOSAVE>DateTimeDelta object v</TD>
<TD NOSAVE>DateTime object w</TD>
<TD>
<P>No operations defined.
</TD>
</TR>
<TR VALIGN=TOP NOSAVE>
<TD NOSAVE>DateTimeDelta object v</TD>
<TD NOSAVE>A number w</TD>
<TD>
<DL>
<DT><CODE>v - w</CODE> <DD> returns a new
DateTimeDelta object with a time delta value
decremented by <CODE>w</CODE> <B>seconds</B> (can be
given as float to indicate fractions of a second);
<DT><CODE>v + w</CODE> <DD> works accordingly; <BR>
Note: you can use the object oneSecond to get similar
effects in a more intuitive way;
<DT><CODE>v * w</CODE> <DD>returns a new DateTimeDelta
object with a time delta value multiplied by
<CODE>float(w)</CODE> (<CODE>w * v</CODE> works in the
same way);
<DT><CODE>v / w</CODE> <DD>returns a new DateTimeDelta
object with a time delta value divided by
<CODE>float(w)</CODE>;
<DT><CODE>v cmp w</CODE> <DD>Converts <CODE>v</CODE>
to a signed float representing the delta in seconds
and returns the result of comparing the seconds value
to the number <CODE>w</CODE>.Note that the comparison
will only yield correct results if the DateTimeDelta
instance is placed on the <I>left</I> of the comparison
operator (this is because of the coercion quirks
mentioned below).
</DL>
</TD>
</TR>
<TR VALIGN=TOP NOSAVE>
<TD NOSAVE>DateTimeDelta object v</TD>
<TD NOSAVE>DateTimeDelta object w</TD>
<TD>
<DL>
<DT><CODE>v + w</CODE> <DD> returns a new
DateTimeDelta object for the sum of the two time
deltas (<CODE>(v+w).seconds == v.seconds +
w.seconds</CODE>);
<DT><CODE>v - w</CODE> <DD>works accordingly;
<DT><CODE>v / w</CODE> <DD> returns a float equal to
<CODE>v.seconds / w.seconds</CODE>.
</DL>
</TD>
</TR>
</TABLE>
<P><U>Notes:</U>
<P>
Operation and argument order are important because of the
different ways arguments are coerced. Use parenthesis to
make your intent clear or you will get unwanted results.
<P>
Due to a flaw in the C interface for coercion in the
interpreter, it is not possible to do proper handling of
mixed type arithmetic for types which don't coerce to a
common type (without creating temporary objets all the
time). The module uses a workaround, but unfortunately the
order of the operands is lost along the way. Under normal
circumstances you won't notice this defect, but be warned
since e.g. <CODE>oneDay - 1 == 1 - oneDay</CODE>, yet
<CODE>oneDay - oneSecond != oneSecond - oneDay</CODE>.
<P>
Comparing RelativeDateTime instances does not work.
<P>
Adding/Subtracting DateTime instances causes the result to
inherit the calendar of the left operand.
<P>
</UL><!--CLASS="indent"-->
<A NAME="Submodules">
<H3>Submodules</H3>
<UL CLASS="indent">
<P>
The package provides additional features in form of the
following submodules. All submodules are imported on request
only.
<A NAME="ISO">
<H4>ISO Submodule</H4>
<UL CLASS="indent">
<P>
The ISO submodule is intended to provide interfacing
functions to <A
HREF="http://www.cl.cam.ac.uk/~mgk25/iso-time.html">ISO 8601
date and time representations </A> (the ISO document is also
available as <A
HREF="http://www.iso.ch/markete/8601.pdf">PDF file</A>).
The most common format is:
<P ALIGN=CENTER>
<TT>YYYY-MM-DD HH:MM:SS[+-HH:MM]</TT>
<P>
<U>Note:</U> <I>timezone information</I> (+-HH:MM) is only
interpreted by the <CODE>ParseDateTimeUTC()</CODE>
constructor. All others ignore the given offset and store
the time value as-is.
<P>
You can access the functions and symbols defined in the
submodule through <CODE>DateTime.ISO</CODE> -- it is
imported on demand.
<P>
The module defines these constructors and functions:
<P><DL>
<DT><CODE><FONT COLOR="#000099">
WeekTime(year,isoweek=1,isoday=1,hour=0,minute=0,second=0.0) </FONT></CODE></DT>
<DD>
Returns a DateTime instance pointing to the given <A
HREF="http://www.cl.cam.ac.uk/~mgk25/iso-time.html">ISO
week and day</A>. isoday defaults to 1, which corresponds
to Monday in the ISO numbering. Note that the resulting
date can in fact lie in the year before the one given as
parameter, e.g. Week(1998,1,1) results in 1997-12-29. The
DateTime instance variable <CODE>iso_week</CODE> provides
an inverse to this function. <P></DD>
<DT><CODE><FONT COLOR="#000099">
Week(year,isoweek,isoday=1) </FONT></CODE></DT>
<DD>
Alias for <CODE>WeekTime()</CODE>. <P></DD>
<DT><CODE><FONT COLOR="#000099">
DateTime(), Time(), TimeDelta()</FONT></CODE></DT>
<DD>
Aliases for the constructors you find in DateTime. Just
included for completeness, since these also use ISO style
notation for their argument order. <P></DD>
<DT><CODE><FONT COLOR="#000099">
ParseDateTime(isostring)</FONT></CODE></DT>
<DD>
Returns a DateTime instance reflecting the given ISO
date.
<P>
A time part is optional and must be delimited from the
date by a space or 'T'. Year must be given, month and
day default to 1. For the time part, hour and minute
must be given, while second defaults to 0.
<P>
Time zone information is parsed, but not evaluated.
<P></DD>
<DT><CODE><FONT COLOR="#000099">
ParseDateTimeGMT(isostring)</FONT></CODE></DT>
<DD>
Same as ParseDateTime() except that timezone information
is used to calculate and return the date/time value in
UTC.
<P>
Note: UTC is practically the same as GMT, the old time
standard.<P></DD>
<DT><CODE><FONT COLOR="#000099">
ParseDateTimeUTC(isostring) </FONT></CODE></DT>
<DD>
Alias for ParseDateTimeGMT().
<P>
Note: UTC is practically the same as GMT, the old time
standard.<P></DD>
<DT><CODE><FONT COLOR="#000099">
ParseDate(isostring)</FONT></CODE></DT>
<DD>
Returns a DateTime instance reflecting the given ISO
date. Year must be given, month and day default to 1. A
time part may not be included. <P></DD>
<DT><CODE><FONT COLOR="#000099">
ParseWeek(isostring)</FONT></CODE></DT>
<DD>
Returns a DateTime instance reflecting the given ISO
date. Year must be given, week number and day are optional
and default to 1. A time part may not be
included. <P></DD>
<DT><CODE><FONT COLOR="#000099">
ParseWeekTime(isostring)</FONT></CODE></DT>
<DD>
Returns a DateTime instance reflecting the given ISO
date. Year must be given, week number and day are optional
and default to 1. A time part may not be
included. <P></DD>
<DT><CODE><FONT COLOR="#000099">
ParseTime(isostring)</FONT></CODE></DT>
<DD>
Returns a DateTimeDelta instance reflecting the given ISO
time. Hours and minutes must be given, seconds are
optional and default to 0. Fractions of a second may also
be used, e.g. '12:23:12.34'. <P></DD>
<DT><CODE><FONT COLOR="#000099">
ParseTimeDelta(isostring)</FONT></CODE></DT>
<DD>
Returns a DateTimeDelta instance reflecting the given ISO
time as delta. Hours and minutes must be given, seconds
are optional and default to 0. Fractions of a second may
also be used, e.g. '12:23:12.34'. In addition to the ISO
standard a sign may be prepended to the time,
e.g. '-12:34'. <P></DD>
<DT><CODE><FONT COLOR="#000099">
ParseAny(isostring)</FONT></CODE></DT>
<DD>
Returns a DateTime[Delta] instance reflecting the given
ISO date and/or time. All ISO formats supported by the
module are understood by this constructor. <P></DD>
<DT><CODE><FONT COLOR="#000099">
str(datetime)</FONT></CODE></DT>
<DD>
Returns the datetime instance as standard ISO date string
(omitting the seconds fraction and always adding timezone
information). The function assumes that the stored value
is given in local time and calculates the correct timezone
offset accordingly.<P></DD>
<DT><CODE><FONT COLOR="#000099">
strGMT(datetime)</FONT></CODE></DT>
<DD>
Returns the datetime instance as ISO date string assuming
it is given in UTC. <P></DD>
<DT><CODE><FONT COLOR="#000099">
strUTC(datetime)</FONT></CODE></DT>
<DD>
Alias for strGMT. <P></DD>
</DL>
<P>
The parsing routines strip surrounding whitespace from the
strings, but are strict in what they want to see. Additional
characters are not allowed and will cause a
<CODE>ValueError</CODE> to be raised.
<P>
Timezone information may be included, but will not be
interpreted unless explicitly stated.
<P>
The parsing routines also understand the ISO 8601 date/time
formats without seperating dashes and colons,
e.g. '19980102T142020', and mixtures of both notations.
<H5>ISO 8601 string formats and DateTime[Delta] instances</H5>
<P>
DateTime and DateTimeDelta instances use a slightly enhanced ISO
format for string represenation:
<P>
DateTime instances are converted to <CODE>'YYYY-MM-DD
HH:MM:SS.ss'</CODE> where the last ss indicate hundredths of a
second (ISO doesn't define how to display these).
<P>
DateTimeDelta instances use <CODE>'[-][DD:]HH:MM:SS.ss'</CODE>
as format, where DD: is only shown for deltas spanning more than
one day (24 hours). The ss part has the same meaning as for
DateTime instances: hundredths of a second. A minus is shown for
negative deltas. ISO does not define relative time deltas, but
the time representation is allowed to be 'HH:MM:SS'.
</UL><!--CLASS="indent"-->
<A NAME="ARPA">
<H4>ARPA Submodule</H4>
<UL CLASS="indent">
<P>
The ARPA submodule is intended to provide interfacing
functions to ARPA date representations. These are used throughout
the Internet for passing around mails, postings, etc. The
format is very simple:
<P ALIGN=CENTER>
<TT>[Day, ]DD Mon YYYY HH:MM[:SS] ZONE</TT>
<P>
where <TT>ZONE</TT> can be one of these: MDT, O, EDT, X, Y,
CDT, UT, AST, GMT, PST, Z, V, CST, ADT, I, W, T, U, R, S, P,
Q, N, EST, L, M, MST, K, H, E, F, G, D, PDT, B, C, UTC, A
(the single letter ones being <A
HREF="http://www.alenafix.com/old-fbg/articles/mil-time.html">military
time zones</A>). Use of explicit time zone names other than
UTC and GMT is depreciated, though. The better alternative
is providing the offset from UTC being in effect at the
given local time: <TT>+-HHMM</TT> (this is the offset you
have to subtract from the given time in order to get UTC).
<P>
You can access the functions and symbols defined in the
submodule through <CODE>DateTime.ARPA</CODE> -- it is
imported on demand.
<P>
The module defines these constructors and functions:
<P><DL>
<DT><CODE><FONT COLOR="#000099">
ParseDate(arpastring) </FONT></CODE></DT>
<DD>
Returns a DateTime instance reflecting the given ARPA
date. Any time part included in the string is silently
ignored. <P></DD>
<DT><CODE><FONT COLOR="#000099">
ParseDateTime(arpastring) </FONT></CODE></DT>
<DD>
Returns a DateTime instance reflecting the given ARPA date
assuming it is local time (timezones are silently
ignored). <P></DD>
<DT><CODE><FONT COLOR="#000099">
ParseDateTimeGMT(arpastring) </FONT></CODE></DT>
<DD>
Returns a DateTime instance reflecting the given ARPA date
converting it to UTC (timezones are honored).<P></DD>
<DT><CODE><FONT COLOR="#000099">
ParseDateTimeUTC(arpastring) </FONT></CODE></DT>
<DD>
Alias for ParseDateTimeGMT(). Note: UTC is practically the
same as GMT, the old time standard.<P></DD>
<DT><CODE><FONT COLOR="#000099">
str(datetime,tz=DateTime.tz_offset(datetime))</FONT></CODE></DT>
<DD>
Returns the datetime instance as ARPA date string. tz can
be given as DateTimeDelta instance providing the time zone
difference from datetime's zone to UTC. It defaults to
DateTime.tz_offset(datetime) which assumes local
time. <P></DD>
<DT><CODE><FONT COLOR="#000099">
strGMT(datetime)</FONT></CODE></DT>
<DD>
Returns the datetime instance as ARPA date string assuming
it is given in GMT using the 'GMT' timezone
indicator.
<P>
<U>Note:</U> Most Internet software expects to find
'GMT' and not 'UTC'.
<P></DD>
<DT><CODE><FONT COLOR="#000099">
strUTC(datetime)</FONT></CODE></DT>
<DD>
Returns the datetime instance as ARPA date string assuming
it is given in UTC using the 'UTC' timezone indicator.
<P></DD>
</DL>
<P>
The parsing routines strip surrounding whitespace from the
strings. Additional characters <I>are</I> allowed (because some
mail apps add extra information to the date header).
</UL><!--CLASS="indent"-->
<A NAME="Feasts">
<H4>Feasts Submodule</H4>
<UL CLASS="indent">
<P>
The Feasts submodule is intended to provide easy-to-use
constructors for common moveable christian feasts that can
be deduced from the date of Easter Sunday.
The algorithm used to calculate Easter Sunday is based on
the one presented in the <A
HREF="http://www.tondering.dk/claus/calendar.html">Calendar
FAQ</A> by Claus Tondering, which in return is based on the
algorithm of Oudin (1940) as quoted in "Explanatory
Supplement to the Astronomical Almanac", P. Kenneth
Seidelmann, editor.
<P>
The module defines these constructors and functions:
<P><DL>
<DT><CODE><FONT COLOR="#000099"> EasterSunday(year),
Ostersonntag(year), DimanchePaques(year) </FONT></CODE></DT>
<DD>
Returns a DateTime instance pointing to Easter Sunday in
the given year at midnight. <P></DD>
</DL>
<P>
The other feasts are deduced from this date and all use the
same interface. The module defines these sets of
constructors the return the corresponding DateTime instance
for midnight of the implied day:
<P>
<UL>
<LI><CODE><FONT COLOR="#000099"> CarnivalMonday(year),
Rosenmontag(year) </FONT></CODE><P>
<LI><CODE><FONT COLOR="#000099"> MardiGras(year)
</FONT></CODE><P>
<LI><CODE><FONT COLOR="#000099"> AshWednesday(year),
Aschermittwoch(year), MercrediCendres(year)
</FONT></CODE><P>
<LI><CODE><FONT COLOR="#000099"> PalmSunday(year),
Palmsonntag(year), DimancheRameaux(year)
</FONT></CODE><P>
<LI><CODE><FONT COLOR="#000099"> EasterFriday(year),
GoodFriday(year), Karfreitag(year), VendrediSaint(year)
</FONT></CODE><P>
<LI><CODE><FONT COLOR="#000099"> EasterMonday(year),
Ostermontag(year), LundiPaques(year) </FONT></CODE><P>
<LI><CODE><FONT COLOR="#000099"> Ascension(year),
Himmelfahrt(year) </FONT></CODE><P>
<LI><CODE><FONT COLOR="#000099"> Pentecost(year),
WhitSunday(year), Pfingstsonntag(year),
DimanchePentecote(year) </FONT></CODE><P>
<LI><CODE><FONT COLOR="#000099"> WhitMonday(year),
Pfingstmontag(year), LundiPentecote(year) </FONT></CODE><P>
<LI><CODE><FONT COLOR="#000099"> TrinitySunday(year)
</FONT></CODE><P>
<LI><CODE><FONT COLOR="#000099"> CorpusChristi(year),
Fronleichnam(year), FeteDieu(year) </FONT></CODE><P>
</UL>
<P>
For further reading, have a look at the <A
HREF="http://www.smart.net/~mmontes/ec-cal.html">Ecclesiastical
Calendar</A>.
</UL><!--CLASS="indent"-->
<A NAME="Parser">
<H4>Parser Submodule</H4>
<UL CLASS="indent">
<P>
The Parser submodule provides constructors for DateTime[Delta]
values taking a string as input. The module knows about quite
a few different date and time formats and will try very hard to
come up with a reasonable output given a valid input.
<P>
Date/time parsing is a very diffcult field of endeavour and
that's why the exact definition of what the module can parse
and what not is defined by implementation rather than a
rigorous set of formats.
<P>
<U>Note:</U> The module still has <B>experimental
status</B>. It is constantly being improved. This can also
mean that some formats might be dropped again in favour of
more general parsing regexps.
<P>
Things the module will recognize are the outputs of ISO,
ARPA and the .strftime() method. Currently only English,
German, French, Spanish and Portuguese month and day names
are supported. Have a look at the source code
(<TT>Parser.py</TT>) for a full list of compatible date/time
formats.
<P>
The module defines these constructors and functions:
<P><DL>
<DT><CODE><FONT COLOR="#000099">
DateTimeFromString(text[, formats, defaultdate]) </FONT></CODE></DT>
<DD>
Returns a DateTime instance reflecting the date and time
given in text. In case a timezone is given, the returned
instance will point to the corresponding UTC time
value. Otherwise, the value is set as given in the string.
<P>
<CODE>formats</CODE> may be set to a tuple of strings
specifying which of the following parsers to use and in
which order to try them. Default is to try all of them
in the order given below:
<UL>
<LI> 'euro' - the European date parser
<LI> 'us' - the US date parser
<LI> 'altus' - the alternative US date parser (with '-' instead of '/')
<LI> 'iso' - the ISO date parser
<LI> 'altiso' - the alternative ISO date parser (without '-')
<LI> 'lit' - the US literal date parser
<LI> 'altlit' - the alternative US literal date parser
<LI> 'eurlit' - the Eurpean literal date parser
<LI> 'unknown' - if no date part is found, use defaultdate
</UL>
<P>
defaultdate provides the defaults to use in case no date
part is found. Most other parsers default to the current
year January 1 if some of these date parts are missing.
<P>
If <CODE>'unknown'</CODE> is not given in formats and
the date/time cannot be parsed, a <CODE>ValueError</CODE> is
raised.
<P></DD>
<DT><CODE><FONT COLOR="#000099">
DateFromString(text[, formats, defaultdate]) </FONT></CODE></DT>
<DD>
Returns a DateTime instance reflecting the date given in
text. A possibly included time part is ignored; the time
part is always set to 0:00:00.00.
<P>
<CODE>formats</CODE> and <CODE>defaultdate</CODE> work
just like for <CODE>DateTimeFromString()</CODE>.
<P></DD>
<DT><CODE><FONT COLOR="#000099">
DateTimeDeltaFromString(text) </FONT></CODE></DT>
<DD>
Returns a DateTimeDelta instance reflecting the delta
given in text. Defaults to 0:00:00:00.00 for parts that
are not included in the textual representation or cannot
be parsed.
<P></DD>
<DT><CODE><FONT COLOR="#000099">
TimeFromString(text) </FONT></CODE></DT>
<DD>
Alias for <CODE>DateTimeDeltaFromString()</CODE>.
<P></DD>
<DT><CODE><FONT COLOR="#000099">
TimeDeltaFromString(text) </FONT></CODE></DT>
<DD>
Alias for <CODE>DateTimeDeltaFromString()</CODE>.
<P></DD>
<DT><CODE><FONT COLOR="#000099">
RelativeDateTimeFromString(text) </FONT></CODE></DT>
<DD>
Returns a RelativeDateTime instance reflecting the
relative date and time given in text.
<P>
Defaults to wildcards (None or 0) for parts or values
which are not included in the textual representation or
cannot be parsed.
<P>
The format used in text must adhere to the following
ISO-style syntax:
<P>
<TT> [YYYY-MM-DD] [HH:MM[:SS]] </TT>
<P>
with the usual meanings.
<P>
Values which should not be altered may be replaced with
'*', '%', '?' or any combination of letters,
e.g. 'YYYY'. Relative settings must be enclosed in
parenthesis if given and should include a sign,
e.g. '(+0001)' for the year part. All other settings are
interpreted as absolute values.
<P>
Date and time parts are both optional as a
whole. Seconds in the time part are optional
too. Everything else (including the hyphens and colons)
is mandatory.
<P></DD>
<DT><CODE><FONT COLOR="#000099">
RelativeDateFromString(text) </FONT></CODE></DT>
<DD>
Same as <CODE>RelativeDateTimeFromString(text)</CODE>
except that only the date part of <CODE>text</CODE> is
taken into account.
<P></DD>
<DT><CODE><FONT COLOR="#000099">
RelativeTimeFromString(text) </FONT></CODE></DT>
<DD>
Same as <CODE>RelativeDateTimeFromString(text)</CODE>
except that only the time part of <CODE>text</CODE> is
taken into account.
<P></DD>
</DL>
<P>
The parsing routines ignore surrounding
whitespace. Additional characters and symbols are ignored.
</UL><!--CLASS="indent"-->
<A NAME="NIST">
<H4>NIST Submodule</H4>
<UL CLASS="indent">
<P>
The NIST submodule is useful when you are connected to the
Internet and want access to the <B>accurate world standard
time</B>, the NIST atomic clocks.
<P>
The module accesses a <A
HREF="http://www.bldrdoc.gov/timefreq/service/nts.htm">special
service</A> provided by NIST and other partner
organizations, which allows anyone with Internet access to
query the current UTC time. Of the three provided protocols,
daytime, time and ntp, I chose the daytime protocol because
of its simplicity and robustness.
<P>
Since access through the Internet can be slow, the module
also provides a way to calibrate itself and then use the
computer's clock without the need to go accross the Internet
for every call to the current time constructors. The
defaults are set in such a way that calibration occurrs
without further interaction on part of the programmer. See
the code for details.
<P>
The module defines these constructors and functions:
<P><DL>
<DT><CODE><FONT COLOR="#000099">
utctime(nist_lookup=0) </FONT></CODE></DT>
<DD>
Returns the current UTC time as DateTime instance.
<P>
Works must like the standard DateTime.now(), but tries
to use the NIST time servers as time reference -- not
only the computer's builtin clock.
<P>
Note that the contructor may take several seconds to
return in case no calibration was performed (see
<CODE>calibrate()</CODE>). With calibration information,
the computer's clock is used as reference and the offset
to NIST time is compensated by the contructor.
<P>
In case the NIST service is not reachable, the
contructor falls back to using either the calibrated
(preferred) or uncalibrated computer's clock.
<P>
Setting <CODE>nist_lookup</CODE> to false (default) will
cause the contructor to prefer the calibrated CPU time
over the expensive Internet queries. If it is true, then
Internet lookups are always tried first before using the
local clock. A value of 2 will cause an
<CODE>Error</CODE> (see below) to be raised in case the
NIST servers are not reachable.
<P>
The constructor will use the received NIST information
for auto calibration.
<P></DD>
<DT><CODE><FONT COLOR="#000099">
gmtime() </FONT></CODE></DT>
<DD>
Alias for utctime().
<P></DD>
<DT><CODE><FONT COLOR="#000099">
localtime(nist_lookup=0) </FONT></CODE></DT>
<DD>
Returns the current local time as DateTime instance.
<P>
Same notes as for utctime().
<P></DD>
<DT><CODE><FONT COLOR="#000099">
now() </FONT></CODE></DT>
<DD>
Alias for localtime().
<P></DD>
<DT><CODE><FONT COLOR="#000099">
time_offset(iterations=10) </FONT></CODE></DT>
<DD>
Returns the average offset of the computer's clock to the NIST
time base in seconds.
<P>
If you add the return value to the return value of
<CODE>time.time()</CODE>, you will have a pretty
accurate time base to use in your applications.
<P>
Note that due to network latencies and the socket
overhead, the calculated offset will include a small
hopefully constant error.
<P>
iterations sets the number of queries done to the NIST
time base. The average is taken over all queries.
<P></DD>
<DT><CODE><FONT COLOR="#000099">
calibrate(iterations=20) </FONT></CODE></DT>
<DD>
Calibrates the localtime() and gmtime() functions supplied
in this module (not the standard ones in DateTime !).
<P>
Uses the NIST time service as time base. The computer
must have an active internet connection to be able to do
calibration using the NIST servers.
<P>
iterations sets the number of round to be done.
<P>
Note: This function takes a few seconds to complete. For
long running processes you should recalibrate every now
and then because the system clock tends to drift
(usually more than the hardware clock in the computer).
<P></DD>
<DT><CODE><FONT COLOR="#000099">
set_calibration(calibration_offset) </FONT></CODE></DT>
<DD>
Sets the calibration to be use by localtime() and utctime().
<P>
This also sets the global <CODE>calibrated</CODE> to 1
and disables auto calibration.
<P></DD>
<DT><CODE><FONT COLOR="#000099">
reset_auto_calibration() </FONT></CODE></DT>
<DD>
Enables and resets the auto calibration for a new round.
<P>
This does not clear possibly available calibration
information, so the two time APIs will continue to
revert to the calibrated clock in case no connection to
the NIST servers is possible.
<P>
Auto calibration is on per default when the module is
imported.
<P></DD>
<DT><CODE><FONT COLOR="#000099">
enable_auto_calibration() </FONT></CODE></DT>
<DD>
Currently an alias for
<CODE>reset_auto_calibration()</CODE>.
<P></DD>
<DT><CODE><FONT COLOR="#000099">
disable_auto_calibration() </FONT></CODE></DT>
<DD>
Turns auto calibration off.
<P></DD>
</DL>
<P>The package defines these constants:
<P>
<DL>
<DT><CODE><FONT COLOR="#000099">
Error </FONT></CODE></DT>
<DD>
This exception is raised by the contructors in case no
connection to the NIST service was possible.
<P></DD>
<DT><CODE><FONT COLOR="#000099">
calibration </FONT></CODE></DT>
<DD>
Current calibration offset (NIST - CPU time) in seconds.
<P></DD>
<DT><CODE><FONT COLOR="#000099">
calibrated </FONT></CODE></DT>
<DD>
True in the global <CODE>calibration</CODE> contains
valid information.
<P></DD>
<DT><CODE><FONT COLOR="#000099">
calibrating </FONT></CODE></DT>
<DD>
If true, the module will Try to auto-calibrate itself
whenever the NIST servers are reachable. <P></DD>
</DL>
<P>
There's an example called <TT>AtomicClock.py</TT> in the
<TT>Examples/</TT> subdir which demonstrates how easy it is
to turn your PC into a fairly accurate time piece.
<P>
For even better time accuracy, one would have to use NTP...
</UL><!--CLASS="indent"-->
</UL><!--CLASS="indent"-->
<A NAME="Examples">
<H3>Examples of Use</H3>
<UL CLASS="indent">
<P>
For an example of how to use the two types to develop other
date/time classes (e.g. ones that support time zones or
other calendars), see the included <TT>ODMG</TT> module. It
defines types similar to those of the ODMG standard.
<P>
Here is a little countdown script:
<FONT COLOR="#000066"><PRE>#!/usr/local/bin/python -u
""" Y2000.py - The year 2000 countdown.
"""
from mx.DateTime import *
from time import sleep
while 1:
d = Date(2000,1,1) - now()
print 'Y2000... time left: %2i days %2i hours '
'%2i minutes %2i seconds\r' % \
(d.day,d.hour,d.minute,d.second),
sleep(1)</PRE></FONT>
<P>
This snippet demonstrates some of the possible string
representations for DateTime instances:
<FONT COLOR="#000066"><PRE>>>> from mx.DateTime import *
>>> ISO.str(now())
'1998-06-14 11:08:27+0200'
>>> ARPA.str(now())
'Sun, 14 Jun 1998 11:08:33 +0200'
>>> now().strftime()
'Sun Jun 14 11:08:51 1998'
>>> str(now())
'1998-06-14 11:09:17.82'</PRE></FONT>
<P>
More examples are available in the <TT>Examples</TT>
subdirectory of the package.
</UL><!--CLASS="indent"-->
<A NAME="API">
<H3>Supported Data Types in the C-API</H3>
<UL CLASS="indent">
Please have look at the file <TT>mxDateTime.h</TT> for details.
Interfacing is provided through a Python C object for ticks, struct
tm, COM doubles, Python tuples and direct input either by giving
absolute date/time or a broken down tuple.
To access the module, do the following (note the similarities with
Python's way of accessing functions from a module):
<PRE>
#include "mxDateTime.h"
...
PyObject *v;
/* Import the mxDateTime module */
if (mxDateTime_ImportModuleAndAPI())
goto onError;
/* Access functions from the exported C API through mxDateTime */
v = mxDateTime.DateTime_FromAbsDateAndTime(729376, 49272.0);
if (!v)
goto onError;
/* Type checking */
if (mxDateTime_Check(v))
printf("Works.\n");
Py_DECREF(v);
...
</PRE>
<P>
</UL><!--CLASS="indent"-->
<A NAME="Structure">
<H3>Package Structure</H3>
<UL CLASS="indent">
<PRE>
[DateTime]
Doc/
[Examples]
AtomicClock.py
CommandLine.py
Y2000.py
alarm.py
lifespan.py
[mxDateTime]
test.py
ARPA.py
DateTime.py
Feasts.py
ISO.py
LazyModule.py
Locale.py
NIST.py
ODMG.py
Parser.py
Timezone.py
timegm.py
</PRE>
<P>
Names with trailing / are plain directories, ones with
[]-brackets are Python packages, ones with ".py" extension
are Python submodules.
<P>
The package imports all symbols from the extension module
and also registers the types so that they become compatible
to the pickle and copy mechanisms in Python.
<P>
</UL><!--CLASS="indent"-->
<A NAME="Support">
<H3>Support</H3>
<UL CLASS="indent">
<P>
eGenix.com is providing commercial support for this
package. If you are interested in receiving information
about this service please see the <A
HREF="http://www.egenix.com/files/python/eGenix-mx-Extensions.html#Support">eGenix.com
Support Conditions</A>.
</UL><!--CLASS="indent"-->
<H3>What I'd like to hear from you...</H3>
<UL CLASS="indent">
<UL>
<LI> Is there anything important still missing ? <P>
</UL>
</UL><!--CLASS="indent"-->
<A NAME="Copyright">
<H3>Copyright & License</H3>
<UL CLASS="indent">
<P>
© 1997-2000, Copyright by Marc-André Lemburg;
All Rights Reserved. mailto: <A
HREF="mailto:mal@lemburg.com">mal@lemburg.com</A>
<P>
© 2000-2001, Copyright by eGenix.com Software GmbH,
Langenfeld, Germany; All Rights Reserved. mailto: <A
HREF="mailto:info@egenix.com">info@egenix.com</A>
<P>
This software is covered by the <A
HREF="mxLicense.html#Public"><B>eGenix.com Public
License Agreement</B></A>. The text of the license is also
included as file "LICENSE" in the package's main directory.
<P>
<B> By downloading, copying, installing or otherwise using
the software, you agree to be bound by the terms and
conditions of the <A HREF="mxLicense.html#Public">eGenix.com
Public License Agreement</A>. </B>
</UL><!--CLASS="indent"-->
<A NAME="History">
<H3>History & Future</H3>
<UL CLASS="indent">
<P>Things that still need to be done:
<P><UL>
<LI> Provide some more examples.
<P><LI> Add timezone information to the parsing routines
or maybe even to DateTime instances. This likely to cause
some trouble with old code, but I think it's worth
considering.
<P><LI> Fix bugs in RelativeDateTime addition and
RelativeDateTimeDiff().
<P><LI> Add Carel Fellinger's age() function.
<P><LI> Add DateTime string format validation APIs to the
Parser module.
</UL>
<P>Things that changed from 2.0.2 to 2.0.3:
<P><UL>
<LI> Made the date/time parser case-insensitive and extended
it to also parse many Eurpean literal date/time formats,
such as 'Sonntag, der 6. November 1994, 08:49:37 GMT'
<P><LI> Fixed a bug in TimeFromTicks(); thanks to Alex
Martelli for finding this one.
<P><LI> Added a new example <TT>numdate.py</TT> by
J.J. Dukarm to the Examples directory which demonstrates
writing date/time parsers using different more strict
conventions. Thanks to JJD for this one !
<P><LI> Fixed the Max/MinDateTime constant and the range
checks in mxDateTime.c to 32-bit values. This allows
mxDateTime to compile correctly on 64-bit
platforms. Thanks to Trond Glomsrod for pointing this out.
<P><LI> Made the date/time parser even more flexible and
added support for partial date formats ('month/day',
'litmonth day', 'day.month.') as well as mixes of
different formats. Another new supported format is
'MM-DD-YYYY' (note that the four year digits are important
to distinguish this format from ISO).
<P><LI> Added 'AM/PM' support to the Parser module.
<P><LI> Made the C extension extra careful about float
rounding bugs, so that dates like 2001-01-01 24:00:00
don't happen anymore. Chuck Esterbrook mentioned that
2.0.2 still had problems on Mandrake (sigh) with
e.g. DateTime(2000,12,31)+1.
<P><LI> Fixed the REs in DateTime.Parser to work with sre
from Python 2.2 (group names have to be unique).
</UL>
<P>Things that changed from 2.0.0 to 2.0.2:
<P><UL>
<LI> Fixed two typos in the Locale submodule. Thanks to
Raul Garcia Garcia for spotting these.
<P><LI> Fixed a bug in the coercion code which surfaced
due to the rich comparison changes in Python 2.1. Python
2.1 will now compare DateTime[Delta] objects to other
objects without raising a TypeError.
</UL>
<P>Things that changed from 1.3.0 to 2.0.0:
<P><UL>
<LI>Fixed a bug in the Parser submodule that caused two
digit years to not fail parsing.
<P><LI>Added more verbose RangeError messages. They now
include the value in question.
<P><LI><B>Changed:</B> The .calendar attributes of
DateTime instances now always return the new constants
Gregorian or Julian. They are currently still implemented
as strings, but this might change in future versions.
<P><LI>The module now checks the system's time functions
for POSIX compatibility. In case it finds that the system
does not use leap seconds in Unix ticks, it reverts to a
simpler and faster method method for calculating the GMT
ticks value from broken down values. This should
significantly speed up processing on platforms that don't
have timegm() and use POSIX ticks.
<P><LI>Added the constants Julian, Gregorian and POSIX.
<P><LI> Fixed a doc-bug: the constructor of DateTimeDelta
objects has a different signature than what was previously
documented -- strange enough, nobody seems to have noticed
this. Perhaps everybody is using the Time() constructor
instead ...
<P><LI>Fixed a bug in Y2000.py: forgot to import sys.
Thanks to Chad Netzer for finding this one.
<P><LI><B>Changed:</B> The C API eported by the C
extension module is now searched under the import path
'mx.DateTime' first. The old path 'DateTime' is only used
as fallback solution.
<P><LI>Fixed a bug in the algorithm for .iso_weeks. It
failed to calculate the right ISO week for a few dates.
Thanks to Gregor Ottmann for finding this one.
<P><LI>Fixed a bug that caused day_of_week to be wrong for
negative dates (in case anyone cares: .iso_weeks/ISO.* now
also work for negative dates).
<P><LI>Changed the internal handling of the time.time()
function. The reference is now set by the
mxDateTime/__init__.py module which should hopefully solve
some problems with using mxDateTime in PyApache setups.
<P><LI>Added .time and .date attributes to DateTime
objects.
<P><LI>Fixed a bug in the calculation of weekdays for
B.C. years. Thanks to Vadim Zeitlin for spotting this one.
<P><LI>Fixed a bug in the __radd__ method of
RelativeDateTime instances: the month part wasn't
correctly handled. Thanks to Paul Epp for finding the bug.
<P><LI>Added some extra checks to gmtime() calls which
caused .gmticks() to sometimes seg fault on WinNT 4
SP4. Found by Gordon McMillan.
<P><LI>Fixed a rounding bug in localtime() and gmtime().
Found by Vadim Chugunov.
<P><LI>Fixed a doc-bug in the defintion of TJD. Thanks to
Tadayoshi Funaba for spotting this one.
<P><LI>Added fixes to make mxDateTime compile on OpenVMS.
Thanks to Jean-Franois Pironne for the patches. He also
provided setup instructions (see the Installation
section).
<P><LI> <B>Changed:</B> The mktime() constructor was
changed to reflect the Python 1.6 change in tuple argument
handling. The constructor now only accepts a 9-tuple.
<P><LI> Redesigned the internals of the Parser module. It
now correctly parses RFC822/RFC1123, RFC850/RFC1036,
ANSI C's asctime() format, ISO format and probably a dozen
more alternative formats. Thanks to Skip Montanaro for
bugging me to fix it ;-)
<P><LI> Added parsers for RelativeDateTime() string
representations.
<P><LI> Added __nonzero__ method to RelativeDateTime
instances: they are considered false in case they do not
define any date or time alterations.
<P><LI> The Parser API will now include the original
string in RangeError messages which occurred during
parsing. Thanks to Skip Montanaro for suggesting this.
<P><LI> Added gmt(), utc(), datetime.gmtime() and
datetime.localtime(); the conversion support is not 100%
robust during DST switching hours, but they work just fine
at all other times.
<P><LI> Added optional faster native API for querying the
current system time. See Setup.in or mxDateTime.c for
details on how to enable it. The speedup is not
tremendous, so it may not be worthwhile the trouble --
unlike time.time() integers, DateTime instances are broken
down to the various date/time values at construction time
and this consumes quite a few cycles.
<P><LI> Added GregorianDateTime() and GregorianDate() as
aliases for DateTime() and Date() for completeness.
<P><LI> Added workaround for rounding bug on Linux
Mandrake. Thanks to John Janecek for bringing this up.
<P><LI> <B>Moved</B> the package under a new top-level
package 'mx'. It is part of the <I>eGenix.com mx BASE
distribution</I>.
</UL>
<P>Things that changed from 1.2.0 to 1.3.0:
<P><UL>
<LI>Added a set of new constructors needed to ease use of
mxDateTime for <A
HREF="http://www.egenix.com/files/python/DatabaseAPI-2.0.html">DB
API 2.0</A> compliant database modules: DateFromTicks,
TimestampFromTicks, TimeFromTicks.
<P><LI><B>Changed:</B> The seconds part is no longer
rounded prior to applying the strftime() C API. It is now
truncated per default. This means that datetime.strftime()
will now always display the seconds integral part as shown
when using str(datetime). Thanks to Shawn Dyer for
pointing this out.
<P>
The exported C API DateTime_AsTmStruct() will also
reflect this change, since it uses the same conversion
routines.
<P><LI> Fixed a bug in the ISO parser: a backslash was
missing which caused parsing of timezone information to
fail. Thanks to Uche Ogbuji for finding the bug.
<P><LI> Extended the timezone parser in ISO.py to handle
'Z' timezone indicators and hours only offsets.
<P><LI>Corrected the JDN bug DateTimeFromJDN(0).jdn == 1.
<P><LI>Corrected a bug in the calculation of Julian dates:
previous versions didn't take into account that the Julian
Epoch is not the same as the Gregorian one. The Julian
calendar implementation should now be correct -- at least
it gives correct dates for all historic dates I could get
my hands on (which aren't as many as I had expected to
find on the net :-/).
<P><LI><B>Changed:</B> Adding/Subtracting DateTime
instances using the Julian calendar now causes the new
instance to use the Julian calendar as well.
<P><LI>Added support for Truncated Julian Day Numbers
(TJD). Both a DateTime attribute (tjd) and a constructor
(DateTimeFromTJD) are available.
<P><LI>Cleaned up the code somewhat to eliminate multiple
instances of the same algorithms.
<P><LI>Modified the test suite to also check the JDN
values and the Julian date constructor.
<P><LI>Corrected a bug that caused repr(datetime) to be
the same as str(datetime).
<P><LI>Added RelativeDateTimeDiff() et al. inspired by a
suggestion from Carel Fellinger for an age calculating
function.
<P><LI>Added NIST submodule and AtomicClock.py example.
</UL>
<P>Things that changed from 1.1.0 to 1.2.0:
<P><UL>
<LI>Fixed a few typos in the Feasts and Locale
submodules. The changes were: Frohnleichnam ->
Fronleichnam and introduction of GoodFriday and
VendrediSaint. Thanks to Wolfgang Weitz for the spell
check.
<P><LI>Fixed a minor bug in localtime() and gmtime().
Thanks to Just van Rossum for finding it (it caused an
OverflowError on Macs).
<P><LI>Added some additional range checks to prevent the
module from crashing on huge date/time values and deltas
due to integer overflows.
<P><LI>Reformatted some doc-strings and parts of the
documentation.
<P><LI>Added TrinitySunday and Pentecost to the Feasts
submodule.
<P><LI>ARPA.strUTC() and ARPA.strGMT() now return strings
using 'UTC' and 'GMT' resp. Most Internet software expects
the string 'GMT' and usually doesn't know how to handle
'UTC'.
<P><LI>Added ARPA.ParseDate().
<P><LI>Added new undocumented and experimental submodules
Parser and Timezone.
<P><LI><B>Added negative years</B> to DateTime
instances. The package follows the convention used in
astronomy which maps the year 0 to 1 B.C.E., -1 to 2
B.C.E., etc. You may need to change code that does not
expect negative years as input.
<P>
XXX Note that the support is still experimental and
still contains some bugs that need fixing... e.g.
DateTimeFromJDN(0).jdn == 1.
<P><LI>Added a few more constants for months and weekdays.
<P><LI><B>Changed</B> the Month attribute in the Locale
instances to a mapping.
<P><LI>The packages RangeError is now a subclass of the
packages Error.
<P><LI><B>Changed</B> the exception types for range errors
to always use DateTime.RangeError instead of
OverflowError.
<P><LI>Fixed a formatting quirk that cause DateTimeDelta
instances to display a negative seconds entry for
-DateTimeDelta(0) in their string repesentation.
<P><LI>Added experimental generic constructors
DateTimeFrom(), DateTimeDeltaFrom() and TimeDeltaFrom().
<P><LI>Fixed the base classes of the two error objects
Error and RangeError: Error has StandardError as base
class and RangeError is a subclass of Error.
<P><LI><B>Changed</B> the now() API to a C function taking
no arguments. Since this is needed quite frequently it
should give better performance. The function uses the
standard Python time module to query the system time. The
documentation for the localtime() function now drops the
default argument previously used -- it still works, but is
depreciated.
<P>
Note that the function no longer does rounding of the
seconds part: you get the full precision returned by the
time.time() function (which is system dependent).
<P><LI>Fixed a bug in the constructor DateTimeFromAbsDays().
<P><LI>Corrected the behaviour of .dst and .tz to also
respect the time of day.
<P><LI>Added a hack to <B>work around a missing
timegm()</B> API. MacOS is one candidate that does not
supply this function. The used workaround should provide
the same functionality at a small performance penalty.
<P>
If you have the timegm() API, enable it in Setup -- it's
more accurate and probably faster too.
<P><LI><B>Depreciated</B> functions gmticks(), utcticks()
and tz_offset(). Use the corresponding methods .gmticks()
and .gmtoffset() instead.
<P><LI>Added .gmtoffset() method.
<P><LI>Added calendar support for Gregorian and Julian
calendars.
<P><LI>Included precompiled MacOS binaries donated by
Joseph Strout. Thanks, Joseph !
<P><LI>Fixed a bug in Timezone.utc_offset().
</UL>
<P>Things that changed from 1.0.1 to 1.1.0:
<P><UL>
<LI>Fixed the hour range check to not accept 24 as input
anymore. Seconds may only have a value between 60.0 and
61.0 for the minute 23:59. The constructor will now raise
a RangeError if it sees other values. Thanks to Jarkko
Torppa for pointing me at it.
<P><LI><B>Changed</B> the keyword order for the
RelativeDateTime constructors. This shouldn't effect any
code, since normal usage is passing the parameters as
keywords anyway.
<P><LI>Added weekday and weeks parameters to
RelativeDateTime; made the instances handle
multiplication, negation and division,
e.g. RelativeDateTime(days=4) / 2 is the same as
RelativeDateTime(days=2). Note that comparing
RelativeDateTime instances does not work.
<P><LI>Added support for [Modified] Julian Day numbers:
constructors and instance variables are available. This
might be useful when you do astronomical date/time
calculations and makes the types even more compatible to
common date/time representations.
<P><LI>RelativeDateTime now allow providing both absolute
and delta values for all entities. The delta value is
added after the absolute value has been set,
e.g. RelativeDateTime(day=1,days=-1) will adjust to the
last day of the previous month.
<P><LI>Reduced the pickle sizes of both types a little
more. DateTime instances now use about 49 bytes and
DateTimeDelta instances around 37 bytes each (43 and 34
bytes if you pickle using the binary option).
<P><LI>Made RelativeDateTime instances handle negative day
settings like DateTime constructors:
RelativeDateTime(day=-1) will adjust to the last day of
the month.
</UL>
<P>Things that changed from 1.0.0 to 1.0.1:
<P><UL>
<LI>Added optional tz keyword parameter to ISO.str and
ARPA.str.
<P><LI>Relaxed the ARPA string parsing routines even
further. Additional characters and spaces are now allowed
in several places.
<P><LI>Fixed the conversion routines for absolute date ->
broken down values. There were reports of rounding errors
occurring for e.g. Date(2000,12,30)+1 on WinNT which cause
the broken down values to be showing out-of-range values
(2001-00-00 in the example). Thanks to Amos Gingerich for
reporting this.
<P><LI>Added a special constructor test to the test script
that will verify the absolute date/time -> broken down and
vice versa conversion routines. The script checks all dates
between 1900-01-01 and 2100-12-31.
</UL>
<P>Things that changed from 0.9.2 to 1.0.0:
<P><UL>
<LI>Changed the <B>DateTime_AsTmStruct() C API</B>. You
now have to pass a pointer to a struct tm to be filled
instead of receiving a malloc'ed struct as in previous
versions. Your compiler will tell you since the signature
changed.
<P><LI>Added gm2local() and local2gm(). Documented some
aliases to the GMT functions with UTC in their name: UTC
and GMT are practically the same. See the <A
HREF="http://www.tondering.dk/claus/calendar.html">Calendar
FAQ</A> for more infos.
<P><LI>Changed the way other extensions import the C API.
They now try to import it through the package rather than
directly through mxDateTime.
<P> This change was needed since there is no way in Python
to make sure that C extensions are really only imported
once: importing mxDateTime directly and indirectly through
the DateTime package lead to two versions of the
extensions being loaded. While this is not too serious at
first sight (it may even be useful in some cases) it turns
out to be a significant problem because the objects
declared by the two versions are seen as being of
different type (type checks in Python are done via
comparing the address of type objects).
<P> As a result, you no longer have to run 'make install'
to install the C extension.
</UL>
<P>Things that changed from 0.9.1 to 0.9.2:
<P><UL>
<LI>Documented (and changed) the tz_offset() helper
function. It used to return an integer value in minutes.
Now it returns a DateTimeDelta instance.
<P><LI>Updated the compiled PYD file to 0.9.1. Note:
nothing changed in the C extension from 0.9.1 to 0.9.2.
<P><LI>Added some more tests to the test script. Be sure
to read the warnings -- there could be problems with
conversions between Unix ticks and the value of DateTime
instances. Some C libs implement non-standard behaviour in
mktime() which can could it to malfunction.
</UL>
<P>Things that changed from 0.9.0 to 0.9.1:
<P><UL>
<LI>Changed the str()/repr() format of DateTime instances
to always show (at least) 4-digits for years, filled with
zeros if necessary.
<P><LI>Relaxed the grammar for ISO dates a little to allow
single digit hours, minutes, seconds, days and months, as
well as years with 3 digits (two digits are not allowed to
prevent ambiguous notations like 98 for 1998).
<P><LI>Added some localizations to the functions in
DateTime.py.
<P><LI>Added support for comparing DateTimeDelta instances
with numbers: the seconds attribute will be used as basis
for the comparison. Because of the coercion problems
arising out of the current coercion scheme used by Python,
the DateTimeDelta instances must always occur on the
<I>left</I> side of the comparison operator to yield
correct results. The same is true for comparing DateTime
instances and numbers.
<P><LI>Added RelativeDateTime objects. These provide a way
to store non-absolute time deltas in a convenient and
intuitive way. As opposed to DateTimeDelta objects which
store absolute deltas, RelativeDateTime objects span
different amounts of time depending on the absolute
DateTime object they are added to, e.g. adding one month
can mean anything from 28 days to 31 days.
<P><LI>Reformatted the docstrings a little.
<P><LI>Documented submodule Feasts. Hope I got those names
right...
</UL>
<P>Older history entries can be found in a <A
HREF="mxDateTime-History.html">seperate list</A>.
<P>
</UL><!--CLASS="indent"-->
<DIV CLASS="footer">
<HR WIDTH="100%">
<CENTER><FONT SIZE=-1>
<P>
© 1997-2000, Copyright by Marc-André Lemburg;
All Rights Reserved. mailto: <A
HREF="mailto:mal@lemburg.com">mal@lemburg.com</A>
<P>
© 2000-2001, Copyright by eGenix.com Software GmbH;
All Rights Reserved. mailto: <A
HREF="mailto:info@egenix.com">info@egenix.com</A>
</FONT></CENTER>
</DIV>
</BODY>
</HTML>
|