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
|
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
<head>
<title>KDateTime</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="Content-Style-Type" content="text/css" />
<link rel="stylesheet" type="text/css" href="../common/doxygen.css" />
<link rel="stylesheet" media="screen" type="text/css" title="KDE Colors" href="../common/kde.css" />
</head>
<body>
<div id="container">
<div id="header">
<div id="header_top">
<div>
<div>
<img alt ="" src="../common/top-kde.jpg"/>
KDE 4.7 PyKDE API Reference
</div>
</div>
</div>
<div id="header_bottom">
<div id="location">
<ul>
<li>KDE's Python API</li>
</ul>
</div>
<div id="menu">
<ul>
<li><a href="../modules.html">Overview</a></li>
<li><a href="http://techbase.kde.org/Development/Languages/Python">PyKDE Home</a></li>
<li><a href="http://kde.org/family/">Sitemap</a></li>
<li><a href="http://kde.org/contact/">Contact Us</a></li>
</ul>
</div>
</div>
</div>
<div id="body_wrapper">
<div id="body">
<div id="right">
<div class="content">
<div id="main">
<div class="clearer"> </div>
<h1>KDateTime Class Reference</h1>
<code>from PyKDE4.kdecore import *</code>
<p>
<h2>Detailed Description</h2>
<p>A class representing a date and time with an associated time zone
</p>
<p>
Topics:
- intro
- manipulation
- compatibility
</p>
<p>
<b>Introduction </b>
</p>
<p>
The class KDateTime combines a date and time with support for an
associated time zone or UTC offset. When manipulating KDateTime objects,
their time zones or UTC offsets are automatically taken into account. KDateTime
can also be set to represent a date-only value with no associated time.
</p>
<p>
The class uses QDateTime internally to represent date/time values, and
therefore uses the Gregorian calendar for dates starting from 15 October 1582,
and the Julian calendar for dates up to 4 October 1582. The minimum year
number is -4712 (4713 BC), while the upper limit is more than 11,000,000. The
actual adoption of the Gregorian calendar after 1582 was slow; the last European
country to adopt it, Greece, did so only in 1923. See QDateTime Considerations
section below for further discussion of the date range limitations.
</p>
<p>
The time specification types which KDateTime supports are:
- the UTC time zone
- a local time with a specified offset from UTC
- a local time in a specified time zone
- a local time using the current system time zone (a special case of the
previous item)
- local clock time, using whatever the local system clock says on whichever
computer it happens to be on. In this case, the equivalent UTC time will
vary depending on system. As a result, calculations involving local clock
times do not necessarily produce reliable results.
</p>
<p>
These characteristics are more fully described in the description of the
SpecType enumeration. Also see
<a href="http://www.w3.org/TR/timezone/">W3C: Working with Time Zones</a>
for a good overview of the different ways of representing times.
</p>
<p>
To set the time specification, use one of the setTimeSpec() methods, to get
the time specification, call timeSpec(), isUtc(), isLocalZone(),
isOffsetFromUtc() or isClockTime(). To determine whether two KDateTime
instances have the same time specification, call timeSpec() on each and
compare the returned values using KDateTime.Spec.operator==().
</p>
<p>
<b>Date and Time Manipulation </b>
</p>
<p>
A KDateTime object can be created by passing a date and time in its
constructor, together with a time specification.
</p>
<p>
If both the date and time are null, isNull() returns true. If the date, time
and time specification are all valid, isValid() returns true.
</p>
<p>
A KDateTime object can be converted to a different time specification by
using toUtc(), toLocalZone() or toClockTime(). It can be converted to a
specific time zone by toZone(). To return the time as an elapsed time since
1 January 1970 (as used by time(2)), use toTime_t(). The results of time
zone conversions are cached to minimize the need for recalculation. Each
KDateTime object caches its UTC equivalent and the last time zone
conversion performed.
</p>
<p>
The date and time can be set either in the constructor, or afterwards by
calling setDate(), setTime() or setDateTime(). To return the date and/or
time components of the KDateTime, use date(), time() and dateTime(). You
can determine whether the KDateTime represents a date and time, or a date
only, by isDateOnly(). You can change between a date and time or a date only
value using setDateOnly().
</p>
<p>
You can increment or decrement the date/time using addSecs(), addDays(),
addMonths() and addYears(). The interval between two date/time values can
be found using secsTo() or daysTo().
</p>
<p>
The comparison operators (operator==(), operator<(), etc.) all take the time
zone properly into account; if the two KDateTime objects have different time
zones, they are first converted to UTC before the comparison is
performed. An alternative to the comparison operators is compare() which will
in addition tell you if a KDateTime object overlaps with another when one or
both are date-only values.
</p>
<p>
KDateTime values may be converted to and from a string representation using
the toString() and fromString() methods. These handle a variety of text
formats including ISO 8601 and RFC 2822.
</p>
<p>
KDateTime uses Qt's facilities to implicitly share data. Copying instances
is very efficient, and copied instances share cached UTC and time zone
conversions even after the copy is performed. A separate copy of the data is
created whenever a non-const method is called. If you want to force the
creation of a separate copy of the data (e.g. if you want two copies to
cache different time zone conversions), call detach().
</p>
<p>
<b>QDateTime Considerations </b>
</p>
<p>
KDateTime's interface is designed to be as compatible as possible with that
of QDateTime, but with adjustments to cater for time zone handling. Because
QDateTime lacks virtual methods, KDateTime is not inherited from QDateTime,
but instead is implemented using a private QDateTime object.
</p>
<p>
The date range restriction due to the use of QDateTime internally may at
first sight seem a design limitation. However, two factors should be
considered:
</p>
<p>
- there are significant problems in the representation of dates before the
Gregorian calendar was adopted. The date of adoption of the Gregorian
calendar varied from place to place, and in the Julian calendar the
date of the new year varied so that in different places the year number
could differ by one. So any date/time system which attempted to represent
dates as actually used in history would be too specialized to belong to
the core KDE libraries. Date/time systems for scientific applications can
be much simpler, but may differ from historical records.
</p>
<p>
- time zones were not invented until the middle of the 19th century. Before
that, solar time was used.
</p>
<p>
Because of these issues, together with the fact that KDateTime's aim is to
provide automatic time zone handling for date/time values, QDateTime was
chosen as the basis for KDateTime. For those who need an extended date
range, other classes exist.
</p>
<p>
<b>Simulation Facility </b>
</p>
<p>
This class provides a facility to simulate the local system time, which
affects all functions using or returning the system time. This facility is
provided for testing purposes only, and is only available if the library is
compiled with debug enabled. In release mode, simulation is inoperative and
the real local system time is used at all times. Use
setSimulatedSystemTime() to set or clear the simulated time. To read the
real (not simulated) system time, use realCurrentLocalDateTime().
</p>
<p>
<dl class="see" compact><dt><b>See also:</b></dt><dd> KTimeZone, KSystemTimeZones, QDateTime, QDate, QTime
</dd></dl> <dl class="see" compact><dt><b>See also:</b></dt><dd> <a href="http://www.w3.org/TR/timezone/">W3C: Working with Time Zones</a>
</dd></dl>
<dl class="author" compact><dt><b>Author:</b></dt><dd> David Jarvie <djarvie@kde.org>. </dd></dl>
</p>
<table border="0" cellpadding="0" cellspacing="0"><tr><td colspan="2"><br><h2>Enumerations</h2></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="el" href="#Comparison">Comparison</a> </td><td class="memItemRight" valign="bottom">{ Before, AtStart, Inside, AtEnd, After, Equal, Outside, StartsAt, EndsAt }</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="el" href="#SpecType">SpecType</a> </td><td class="memItemRight" valign="bottom">{ Invalid, UTC, OffsetFromUTC, TimeZone, LocalZone, ClockTime }</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="el" href="#TimeFormat">TimeFormat</a> </td><td class="memItemRight" valign="bottom">{ ISODate, RFCDate, RFCDateDay, QtTextDate, LocalDate, RFC3339Date }</td></tr>
<tr><td colspan="2"><br><h2>Methods</h2></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"> </td><td class="memItemRight" valign="bottom"><a class="el" href="#KDateTime">__init__</a> (self)</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"> </td><td class="memItemRight" valign="bottom"><a class="el" href="#KDateTime">__init__</a> (self, QDate date, <a href="../kdecore/KDateTime.Spec.html">KDateTime.Spec</a> spec=KDateTime.Spec(KDateTime.LocalZone))</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"> </td><td class="memItemRight" valign="bottom"><a class="el" href="#KDateTime">__init__</a> (self, QDate date, QTime time, <a href="../kdecore/KDateTime.Spec.html">KDateTime.Spec</a> spec=KDateTime.Spec(KDateTime.LocalZone))</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"> </td><td class="memItemRight" valign="bottom"><a class="el" href="#KDateTime">__init__</a> (self, QDateTime dt, <a href="../kdecore/KDateTime.Spec.html">KDateTime.Spec</a> spec)</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"> </td><td class="memItemRight" valign="bottom"><a class="el" href="#KDateTime">__init__</a> (self, QDateTime dt)</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"> </td><td class="memItemRight" valign="bottom"><a class="el" href="#KDateTime">__init__</a> (self, <a href="../kdecore/KDateTime.html">KDateTime</a> other)</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a href="../kdecore/KDateTime.html">KDateTime</a> </td><td class="memItemRight" valign="bottom"><a class="el" href="#addDays">addDays</a> (self, int days)</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a href="../kdecore/KDateTime.html">KDateTime</a> </td><td class="memItemRight" valign="bottom"><a class="el" href="#addMSecs">addMSecs</a> (self, long msecs)</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a href="../kdecore/KDateTime.html">KDateTime</a> </td><td class="memItemRight" valign="bottom"><a class="el" href="#addMonths">addMonths</a> (self, int months)</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a href="../kdecore/KDateTime.html">KDateTime</a> </td><td class="memItemRight" valign="bottom"><a class="el" href="#addSecs">addSecs</a> (self, long secs)</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a href="../kdecore/KDateTime.html">KDateTime</a> </td><td class="memItemRight" valign="bottom"><a class="el" href="#addYears">addYears</a> (self, int years)</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a href="../kdecore/KDateTime.html#Comparison">KDateTime.Comparison</a> </td><td class="memItemRight" valign="bottom"><a class="el" href="#compare">compare</a> (self, <a href="../kdecore/KDateTime.html">KDateTime</a> other)</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">QDate </td><td class="memItemRight" valign="bottom"><a class="el" href="#date">date</a> (self)</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">QDateTime </td><td class="memItemRight" valign="bottom"><a class="el" href="#dateTime">dateTime</a> (self)</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">int </td><td class="memItemRight" valign="bottom"><a class="el" href="#daysTo">daysTo</a> (self, <a href="../kdecore/KDateTime.html">KDateTime</a> other)</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"> </td><td class="memItemRight" valign="bottom"><a class="el" href="#detach">detach</a> (self)</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">bool </td><td class="memItemRight" valign="bottom"><a class="el" href="#isClockTime">isClockTime</a> (self)</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">bool </td><td class="memItemRight" valign="bottom"><a class="el" href="#isDateOnly">isDateOnly</a> (self)</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">bool </td><td class="memItemRight" valign="bottom"><a class="el" href="#isLocalZone">isLocalZone</a> (self)</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">bool </td><td class="memItemRight" valign="bottom"><a class="el" href="#isNull">isNull</a> (self)</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">bool </td><td class="memItemRight" valign="bottom"><a class="el" href="#isOffsetFromUtc">isOffsetFromUtc</a> (self)</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">bool </td><td class="memItemRight" valign="bottom"><a class="el" href="#isSecondOccurrence">isSecondOccurrence</a> (self)</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">bool </td><td class="memItemRight" valign="bottom"><a class="el" href="#isUtc">isUtc</a> (self)</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">bool </td><td class="memItemRight" valign="bottom"><a class="el" href="#isValid">isValid</a> (self)</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">bool </td><td class="memItemRight" valign="bottom"><a class="el" href="#operator !=">operator !=</a> (self, <a href="../kdecore/KDateTime.html">KDateTime</a> other)</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">bool </td><td class="memItemRight" valign="bottom"><a class="el" href="#operator <">operator <</a> (self, <a href="../kdecore/KDateTime.html">KDateTime</a> other)</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">bool </td><td class="memItemRight" valign="bottom"><a class="el" href="#operator <=">operator <=</a> (self, <a href="../kdecore/KDateTime.html">KDateTime</a> other)</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">bool </td><td class="memItemRight" valign="bottom"><a class="el" href="#operator ==">operator ==</a> (self, <a href="../kdecore/KDateTime.html">KDateTime</a> other)</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">bool </td><td class="memItemRight" valign="bottom"><a class="el" href="#operator >">operator ></a> (self, <a href="../kdecore/KDateTime.html">KDateTime</a> other)</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">bool </td><td class="memItemRight" valign="bottom"><a class="el" href="#operator >=">operator >=</a> (self, <a href="../kdecore/KDateTime.html">KDateTime</a> other)</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">bool </td><td class="memItemRight" valign="bottom"><a class="el" href="#outOfRange">outOfRange</a> (self)</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">int </td><td class="memItemRight" valign="bottom"><a class="el" href="#secsTo">secsTo</a> (self, <a href="../kdecore/KDateTime.html">KDateTime</a> other)</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">long </td><td class="memItemRight" valign="bottom"><a class="el" href="#secsTo_long">secsTo_long</a> (self, <a href="../kdecore/KDateTime.html">KDateTime</a> other)</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"> </td><td class="memItemRight" valign="bottom"><a class="el" href="#setDate">setDate</a> (self, QDate date)</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"> </td><td class="memItemRight" valign="bottom"><a class="el" href="#setDateOnly">setDateOnly</a> (self, bool dateOnly)</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"> </td><td class="memItemRight" valign="bottom"><a class="el" href="#setDateTime">setDateTime</a> (self, QDateTime dt)</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"> </td><td class="memItemRight" valign="bottom"><a class="el" href="#setSecondOccurrence">setSecondOccurrence</a> (self, bool second)</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"> </td><td class="memItemRight" valign="bottom"><a class="el" href="#setTime">setTime</a> (self, QTime time)</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"> </td><td class="memItemRight" valign="bottom"><a class="el" href="#setTimeSpec">setTimeSpec</a> (self, <a href="../kdecore/KDateTime.Spec.html">KDateTime.Spec</a> spec)</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"> </td><td class="memItemRight" valign="bottom"><a class="el" href="#setTime_t">setTime_t</a> (self, long seconds)</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">QTime </td><td class="memItemRight" valign="bottom"><a class="el" href="#time">time</a> (self)</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a href="../kdecore/KDateTime.Spec.html">KDateTime.Spec</a> </td><td class="memItemRight" valign="bottom"><a class="el" href="#timeSpec">timeSpec</a> (self)</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a href="../kdecore/KDateTime.html#SpecType">KDateTime.SpecType</a> </td><td class="memItemRight" valign="bottom"><a class="el" href="#timeType">timeType</a> (self)</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a href="../kdecore/KTimeZone.html">KTimeZone</a> </td><td class="memItemRight" valign="bottom"><a class="el" href="#timeZone">timeZone</a> (self)</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a href="../kdecore/KDateTime.html">KDateTime</a> </td><td class="memItemRight" valign="bottom"><a class="el" href="#toClockTime">toClockTime</a> (self)</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a href="../kdecore/KDateTime.html">KDateTime</a> </td><td class="memItemRight" valign="bottom"><a class="el" href="#toLocalZone">toLocalZone</a> (self)</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a href="../kdecore/KDateTime.html">KDateTime</a> </td><td class="memItemRight" valign="bottom"><a class="el" href="#toOffsetFromUtc">toOffsetFromUtc</a> (self)</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a href="../kdecore/KDateTime.html">KDateTime</a> </td><td class="memItemRight" valign="bottom"><a class="el" href="#toOffsetFromUtc">toOffsetFromUtc</a> (self, int utcOffset)</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">QString </td><td class="memItemRight" valign="bottom"><a class="el" href="#toString">toString</a> (self, QString format)</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">QString </td><td class="memItemRight" valign="bottom"><a class="el" href="#toString">toString</a> (self, <a href="../kdecore/KDateTime.html#TimeFormat">KDateTime.TimeFormat</a> format=KDateTime.ISODate)</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a href="../kdecore/KDateTime.html">KDateTime</a> </td><td class="memItemRight" valign="bottom"><a class="el" href="#toTimeSpec">toTimeSpec</a> (self, <a href="../kdecore/KDateTime.Spec.html">KDateTime.Spec</a> spec)</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a href="../kdecore/KDateTime.html">KDateTime</a> </td><td class="memItemRight" valign="bottom"><a class="el" href="#toTimeSpec">toTimeSpec</a> (self, <a href="../kdecore/KDateTime.html">KDateTime</a> dt)</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">long </td><td class="memItemRight" valign="bottom"><a class="el" href="#toTime_t">toTime_t</a> (self)</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a href="../kdecore/KDateTime.html">KDateTime</a> </td><td class="memItemRight" valign="bottom"><a class="el" href="#toUtc">toUtc</a> (self)</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a href="../kdecore/KDateTime.html">KDateTime</a> </td><td class="memItemRight" valign="bottom"><a class="el" href="#toZone">toZone</a> (self, <a href="../kdecore/KTimeZone.html">KTimeZone</a> zone)</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">int </td><td class="memItemRight" valign="bottom"><a class="el" href="#utcOffset">utcOffset</a> (self)</td></tr>
<tr><td colspan="2"><br><h2>Static Methods</h2></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a href="../kdecore/KDateTime.html">KDateTime</a> </td><td class="memItemRight" valign="bottom"><a class="el" href="#currentDateTime">currentDateTime</a> (<a href="../kdecore/KDateTime.Spec.html">KDateTime.Spec</a> spec)</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">QDate </td><td class="memItemRight" valign="bottom"><a class="el" href="#currentLocalDate">currentLocalDate</a> ()</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a href="../kdecore/KDateTime.html">KDateTime</a> </td><td class="memItemRight" valign="bottom"><a class="el" href="#currentLocalDateTime">currentLocalDateTime</a> ()</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">QTime </td><td class="memItemRight" valign="bottom"><a class="el" href="#currentLocalTime">currentLocalTime</a> ()</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a href="../kdecore/KDateTime.html">KDateTime</a> </td><td class="memItemRight" valign="bottom"><a class="el" href="#currentUtcDateTime">currentUtcDateTime</a> ()</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a href="../kdecore/KDateTime.html">KDateTime</a>, bool negZero </td><td class="memItemRight" valign="bottom"><a class="el" href="#fromString">fromString</a> (QString string, <a href="../kdecore/KDateTime.html#TimeFormat">KDateTime.TimeFormat</a> format=KDateTime.ISODate)</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a href="../kdecore/KDateTime.html">KDateTime</a> </td><td class="memItemRight" valign="bottom"><a class="el" href="#fromString">fromString</a> (QString string, QString format, <a href="../kdecore/KTimeZones.html">KTimeZones</a> zones=0, bool offsetIfAmbiguous=1)</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a href="../kdecore/KDateTime.html">KDateTime</a> </td><td class="memItemRight" valign="bottom"><a class="el" href="#realCurrentLocalDateTime">realCurrentLocalDateTime</a> ()</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"> </td><td class="memItemRight" valign="bottom"><a class="el" href="#setFromStringDefault">setFromStringDefault</a> (<a href="../kdecore/KDateTime.Spec.html">KDateTime.Spec</a> spec)</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"> </td><td class="memItemRight" valign="bottom"><a class="el" href="#setSimulatedSystemTime">setSimulatedSystemTime</a> (<a href="../kdecore/KDateTime.html">KDateTime</a> newTime)</td></tr>
</table>
<hr><h2>Method Documentation</h2><a class="anchor" name="KDateTime"></a>
<div class="memitem">
<div class="memproto">
<table class="memname"><tr>
<td class="memname">__init__</td>
<td>(</td>
<td class="paramtype"> </td>
<td class="paramname"><em>self</em> )</td>
<td width="100%"> </td>
</tr>
</table>
</div>
<div class="memdoc"><p>Constructs an invalid date/time.
</p></div></div><a class="anchor" name="KDateTime"></a>
<div class="memitem">
<div class="memproto">
<table class="memname"><tr>
<td class="memname">__init__</td>
<td>(</td>
<td class="paramtype"> <em>self</em>, </td>
<td class="paramname"></td>
</tr><tr>
<td class="memname"></td>
<td></td>
<td class="paramtype">QDate </td>
<td class="paramname"><em>date</em>, </td>
</tr>
<tr>
<td class="memname"></td>
<td></td>
<td class="paramtype"><a href="../kdecore/KDateTime.Spec.html">KDateTime.Spec</a> </td>
<td class="paramname"><em>spec=KDateTime.Spec(KDateTime.LocalZone)</em></td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td>
<td></td>
<td width="100%"> </td>
</tr></table>
</div>
<div class="memdoc"><p>Constructs a date-only value expressed in a given time specification. The
time is set to 00:00:00.
</p>
<p>
The instance is initialised according to the time specification type of
<b>spec</b> as follows:
- UTC : date is stored as UTC.
- OffsetFromUTC : date is a local time at the specified offset
from UTC.
- TimeZone : date is a local time in the specified time zone.
- LocalZone : date is a local date in the current system time
zone.
- ClockTime : time zones are ignored.
</p>
<p>
</p><dl compact><dt><b>Parameters:</b></dt><dd>
<table border="0" cellspacing="2" cellpadding="0">
<tr><td></td><td valign="top"><em>date</em> </td><td> date in the time zone indicated by <b>spec</b>
<tr><td></td><td valign="top"><em>spec</em> </td><td> time specification
</td></tr>
</table></dl>
<p>
</p></div></div><a class="anchor" name="KDateTime"></a>
<div class="memitem">
<div class="memproto">
<table class="memname"><tr>
<td class="memname">__init__</td>
<td>(</td>
<td class="paramtype"> <em>self</em>, </td>
<td class="paramname"></td>
</tr><tr>
<td class="memname"></td>
<td></td>
<td class="paramtype">QDate </td>
<td class="paramname"><em>date</em>, </td>
</tr>
<tr>
<td class="memname"></td>
<td></td>
<td class="paramtype">QTime </td>
<td class="paramname"><em>time</em>, </td>
</tr>
<tr>
<td class="memname"></td>
<td></td>
<td class="paramtype"><a href="../kdecore/KDateTime.Spec.html">KDateTime.Spec</a> </td>
<td class="paramname"><em>spec=KDateTime.Spec(KDateTime.LocalZone)</em></td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td>
<td></td>
<td width="100%"> </td>
</tr></table>
</div>
<div class="memdoc"><p>Constructs a date/time expressed as specified by <b>spec.</b>
</p>
<p>
<b>date</b> and <b>time</b> are interpreted and stored according to the value of
<b>spec</b> as follows:
- UTC : <b>date</b> and <b>time</b> are in UTC.
- OffsetFromUTC : date/time is a local time at the specified offset
from UTC.
- TimeZone : date/time is a local time in the specified time zone.
- LocalZone : <b>date</b> and <b>time</b> are local times in the current
system time zone.
- ClockTime : time zones are ignored.
</p>
<p>
</p><dl compact><dt><b>Parameters:</b></dt><dd>
<table border="0" cellspacing="2" cellpadding="0">
<tr><td></td><td valign="top"><em>date</em> </td><td> date in the time zone indicated by <b>spec</b>
<tr><td></td><td valign="top"><em>time</em> </td><td> time in the time zone indicated by <b>spec</b>
<tr><td></td><td valign="top"><em>spec</em> </td><td> time specification
</td></tr>
</table></dl>
<p>
</p></div></div><a class="anchor" name="KDateTime"></a>
<div class="memitem">
<div class="memproto">
<table class="memname"><tr>
<td class="memname">__init__</td>
<td>(</td>
<td class="paramtype"> <em>self</em>, </td>
<td class="paramname"></td>
</tr><tr>
<td class="memname"></td>
<td></td>
<td class="paramtype">QDateTime </td>
<td class="paramname"><em>dt</em>, </td>
</tr>
<tr>
<td class="memname"></td>
<td></td>
<td class="paramtype"><a href="../kdecore/KDateTime.Spec.html">KDateTime.Spec</a> </td>
<td class="paramname"><em>spec</em></td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td>
<td></td>
<td width="100%"> </td>
</tr></table>
</div>
<div class="memdoc"><p>Constructs a date/time expressed in a given time specification.
</p>
<p>
<b>dt</b> is interpreted and stored according to the time specification type
of <b>spec</b> as follows:
- UTC : <b>dt</b> is stored as a UTC value. If
dt.timeSpec() is Qt.LocalTime, <b>dt</b> is first
converted from the current system time zone to UTC
before storage.
- OffsetFromUTC : date/time is stored as a local time at the specified
offset from UTC. If dt.timeSpec() is Qt.UTC,
the time is adjusted by the UTC offset before
storage. If dt.timeSpec() is Qt.LocalTime,
it is assumed to be a local time at the specified
offset from UTC, and is stored without adjustment.
- TimeZone : if <b>dt</b> is specified as a UTC time (i.e. dt.timeSpec()
is Qt.UTC), it is first converted to local time in
specified time zone before being stored.
- LocalZone : <b>dt</b> is stored as a local time in the current system
time zone. If dt.timeSpec() is Qt.UTC, <b>dt</b> is
first converted to local time before storage.
- ClockTime : If dt.timeSpec() is Qt.UTC, <b>dt</b> is first
converted to local time in the current system time zone
before storage. After storage, the time is treated as a
simple clock time, ignoring time zones.
</p>
<p>
</p><dl compact><dt><b>Parameters:</b></dt><dd>
<table border="0" cellspacing="2" cellpadding="0">
<tr><td></td><td valign="top"><em>dt</em> </td><td> date and time
<tr><td></td><td valign="top"><em>spec</em> </td><td> time specification
</td></tr>
</table></dl>
<p>
</p></div></div><a class="anchor" name="KDateTime"></a>
<div class="memitem">
<div class="memproto">
<table class="memname"><tr>
<td class="memname">__init__</td>
<td>(</td>
<td class="paramtype"> <em>self</em>, </td>
<td class="paramname"></td>
</tr><tr>
<td class="memname"></td>
<td></td>
<td class="paramtype">QDateTime </td>
<td class="paramname"><em>dt</em></td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td>
<td></td>
<td width="100%"> </td>
</tr></table>
</div>
<div class="memdoc"><p>Constructs a date/time from a QDateTime.
The KDateTime is expressed in either UTC or the local system time zone,
according to <b>dt.timeSpec().</b>
</p>
<p>
</p><dl compact><dt><b>Parameters:</b></dt><dd>
<table border="0" cellspacing="2" cellpadding="0">
<tr><td></td><td valign="top"><em>dt</em> </td><td> date and time
</td></tr>
</table></dl>
<p>
</p></div></div><a class="anchor" name="KDateTime"></a>
<div class="memitem">
<div class="memproto">
<table class="memname"><tr>
<td class="memname">__init__</td>
<td>(</td>
<td class="paramtype"> <em>self</em>, </td>
<td class="paramname"></td>
</tr><tr>
<td class="memname"></td>
<td></td>
<td class="paramtype"><a href="../kdecore/KDateTime.html">KDateTime</a> </td>
<td class="paramname"><em>other</em></td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td>
<td></td>
<td width="100%"> </td>
</tr></table>
</div>
<div class="memdoc"></div></div><a class="anchor" name="addDays"></a>
<div class="memitem">
<div class="memproto">
<table class="memname"><tr>
<td class="memname"><a href="../kdecore/KDateTime.html">KDateTime</a> addDays</td>
<td>(</td>
<td class="paramtype"> <em>self</em>, </td>
<td class="paramname"></td>
</tr><tr>
<td class="memname"></td>
<td></td>
<td class="paramtype">int </td>
<td class="paramname"><em>days</em></td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td>
<td></td>
<td width="100%"> </td>
</tr></table>
</div>
<div class="memdoc"><p>Returns a date/time <b>days</b> days later than the stored date/time.
The result is expressed using the same time specification as the
original instance.
</p>
<p>
Note that if the instance is a local clock time (type ClockTime), any
daylight savings changes or time zone changes during the period may
render the result inaccurate.
</p>
<p>
<dl class="return" compact><dt><b>Returns:</b></dt><dd> resultant date/time
</dd></dl> <dl class="see" compact><dt><b>See also:</b></dt><dd> addSecs(), addMonths(), addYears(), daysTo()
</dd></dl>
</p></div></div><a class="anchor" name="addMSecs"></a>
<div class="memitem">
<div class="memproto">
<table class="memname"><tr>
<td class="memname"><a href="../kdecore/KDateTime.html">KDateTime</a> addMSecs</td>
<td>(</td>
<td class="paramtype"> <em>self</em>, </td>
<td class="paramname"></td>
</tr><tr>
<td class="memname"></td>
<td></td>
<td class="paramtype">long </td>
<td class="paramname"><em>msecs</em></td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td>
<td></td>
<td width="100%"> </td>
</tr></table>
</div>
<div class="memdoc"><p>Returns a date/time <b>msecs</b> milliseconds later than the stored date/time.
</p>
<p>
Except when the instance is a local clock time (type ClockTime), the
calculation is done in UTC to ensure that the result takes proper account
of clock changes (e.g. daylight savings) in the time zone. The result is
expressed using the same time specification as the original instance.
</p>
<p>
Note that if the instance is a local clock time (type ClockTime), any
daylight savings changes or time zone changes during the period will
render the result inaccurate.
</p>
<p>
If the instance is date-only, <b>msecs</b> is rounded down to a whole number
of days and that value is added to the date to find the result.
</p>
<p>
<dl class="return" compact><dt><b>Returns:</b></dt><dd> resultant date/time
</dd></dl> <dl class="see" compact><dt><b>See also:</b></dt><dd> addSecs(), addDays(), addMonths(), addYears(), secsTo()
</dd></dl>
</p></div></div><a class="anchor" name="addMonths"></a>
<div class="memitem">
<div class="memproto">
<table class="memname"><tr>
<td class="memname"><a href="../kdecore/KDateTime.html">KDateTime</a> addMonths</td>
<td>(</td>
<td class="paramtype"> <em>self</em>, </td>
<td class="paramname"></td>
</tr><tr>
<td class="memname"></td>
<td></td>
<td class="paramtype">int </td>
<td class="paramname"><em>months</em></td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td>
<td></td>
<td width="100%"> </td>
</tr></table>
</div>
<div class="memdoc"><p>Returns a date/time <b>months</b> months later than the stored date/time.
The result is expressed using the same time specification as the
original instance.
</p>
<p>
Note that if the instance is a local clock time (type ClockTime), any
daylight savings changes or time zone changes during the period may
render the result inaccurate.
</p>
<p>
<dl class="return" compact><dt><b>Returns:</b></dt><dd> resultant date/time
</dd></dl> <dl class="see" compact><dt><b>See also:</b></dt><dd> addSecs(), addDays(), addYears(), daysTo()
</dd></dl>
</p></div></div><a class="anchor" name="addSecs"></a>
<div class="memitem">
<div class="memproto">
<table class="memname"><tr>
<td class="memname"><a href="../kdecore/KDateTime.html">KDateTime</a> addSecs</td>
<td>(</td>
<td class="paramtype"> <em>self</em>, </td>
<td class="paramname"></td>
</tr><tr>
<td class="memname"></td>
<td></td>
<td class="paramtype">long </td>
<td class="paramname"><em>secs</em></td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td>
<td></td>
<td width="100%"> </td>
</tr></table>
</div>
<div class="memdoc"><p>Returns a date/time <b>secs</b> seconds later than the stored date/time.
</p>
<p>
Except when the instance is a local clock time (type ClockTime), the
calculation is done in UTC to ensure that the result takes proper account
of clock changes (e.g. daylight savings) in the time zone. The result is
expressed using the same time specification as the original instance.
</p>
<p>
Note that if the instance is a local clock time (type ClockTime), any
daylight savings changes or time zone changes during the period will
render the result inaccurate.
</p>
<p>
If the instance is date-only, <b>secs</b> is rounded down to a whole number
of days and that value is added to the date to find the result.
</p>
<p>
<dl class="return" compact><dt><b>Returns:</b></dt><dd> resultant date/time
</dd></dl> <dl class="see" compact><dt><b>See also:</b></dt><dd> addMSecs(), addDays(), addMonths(), addYears(), secsTo()
</dd></dl>
</p></div></div><a class="anchor" name="addYears"></a>
<div class="memitem">
<div class="memproto">
<table class="memname"><tr>
<td class="memname"><a href="../kdecore/KDateTime.html">KDateTime</a> addYears</td>
<td>(</td>
<td class="paramtype"> <em>self</em>, </td>
<td class="paramname"></td>
</tr><tr>
<td class="memname"></td>
<td></td>
<td class="paramtype">int </td>
<td class="paramname"><em>years</em></td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td>
<td></td>
<td width="100%"> </td>
</tr></table>
</div>
<div class="memdoc"><p>Returns a date/time <b>years</b> years later than the stored date/time.
The result is expressed using the same time specification as the
original instance.
</p>
<p>
Note that if the instance is a local clock time (type ClockTime), any
daylight savings changes or time zone changes during the period may
render the result inaccurate.
</p>
<p>
<dl class="return" compact><dt><b>Returns:</b></dt><dd> resultant date/time
</dd></dl> <dl class="see" compact><dt><b>See also:</b></dt><dd> addSecs(), addDays(), addMonths(), daysTo()
</dd></dl>
</p></div></div><a class="anchor" name="compare"></a>
<div class="memitem">
<div class="memproto">
<table class="memname"><tr>
<td class="memname"><a href="../kdecore/KDateTime.html#Comparison">KDateTime.Comparison</a> compare</td>
<td>(</td>
<td class="paramtype"> <em>self</em>, </td>
<td class="paramname"></td>
</tr><tr>
<td class="memname"></td>
<td></td>
<td class="paramtype"><a href="../kdecore/KDateTime.html">KDateTime</a> </td>
<td class="paramname"><em>other</em></td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td>
<td></td>
<td width="100%"> </td>
</tr></table>
</div>
<div class="memdoc"><p>Compare this instance with another to determine whether they are
simultaneous, earlier or later, and in the case of date-only values,
whether they overlap (i.e. partly coincide but are not wholly
simultaneous).
The comparison takes time zones into account: if the two instances have
different time zones, they are first converted to UTC before comparing.
</p>
<p>
If both instances are date/time values, this instance is considered to
be either simultaneous, earlier or later, and does not overlap.
</p>
<p>
If one instance is date-only and the other is a date/time, this instance
is either strictly earlier, strictly later, or overlaps.
</p>
<p>
If both instance are date-only, they are considered simultaneous if both
their start of day and end of day times are simultaneous with each
other. (Both start and end of day times need to be considered in case a
daylight savings change occurs during that day.) Otherwise, this instance
can be strictly earlier, earlier but overlapping, later but overlapping,
or strictly later.
</p>
<p>
Note that if either instance is a local clock time (type ClockTime),
the result cannot be guaranteed to be correct, since by definition they
contain no information about time zones or daylight savings changes.
</p>
<p>
<dl class="return" compact><dt><b>Returns:</b></dt><dd> true if the two instances represent the same time, false otherwise
</dd></dl> <dl class="see" compact><dt><b>See also:</b></dt><dd> operator==(), operator!=(), operator<(), operator<=(), operator>=(), operator>()
</dd></dl>
</p></div></div><a class="anchor" name="date"></a>
<div class="memitem">
<div class="memproto">
<table class="memname"><tr>
<td class="memname">QDate date</td>
<td>(</td>
<td class="paramtype"> </td>
<td class="paramname"><em>self</em> )</td>
<td width="100%"> </td>
</tr>
</table>
</div>
<div class="memdoc"><p>Returns the date part of the date/time. The value returned should be
interpreted in terms of the instance's time zone or UTC offset.
</p>
<p>
<dl class="return" compact><dt><b>Returns:</b></dt><dd> date value
</dd></dl> <dl class="see" compact><dt><b>See also:</b></dt><dd> time(), dateTime()
</dd></dl>
</p></div></div><a class="anchor" name="dateTime"></a>
<div class="memitem">
<div class="memproto">
<table class="memname"><tr>
<td class="memname">QDateTime dateTime</td>
<td>(</td>
<td class="paramtype"> </td>
<td class="paramname"><em>self</em> )</td>
<td width="100%"> </td>
</tr>
</table>
</div>
<div class="memdoc"><p>Returns the date/time component of the instance, ignoring the time
zone. The value returned should be interpreted in terms of the
instance's time zone or UTC offset. The returned value's timeSpec()
value will be Qt.UTC if the instance is a UTC time, else
Qt.LocalTime. If the instance is date-only, the time value is set to
00:00:00.
</p>
<p>
<dl class="return" compact><dt><b>Returns:</b></dt><dd> date/time
</dd></dl> <dl class="see" compact><dt><b>See also:</b></dt><dd> date(), time()
</dd></dl>
</p></div></div><a class="anchor" name="daysTo"></a>
<div class="memitem">
<div class="memproto">
<table class="memname"><tr>
<td class="memname">int daysTo</td>
<td>(</td>
<td class="paramtype"> <em>self</em>, </td>
<td class="paramname"></td>
</tr><tr>
<td class="memname"></td>
<td></td>
<td class="paramtype"><a href="../kdecore/KDateTime.html">KDateTime</a> </td>
<td class="paramname"><em>other</em></td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td>
<td></td>
<td width="100%"> </td>
</tr></table>
</div>
<div class="memdoc"><p>Calculates the number of days from this date/time to the <b>other</b> date/time.
In calculating the result, <b>other</b> is first converted to this instance's
time zone. The number of days difference is then calculated ignoring
the time parts of the two date/times. For example, if this date/time
was 13:00 on 1 January 2000, and <b>other</b> was 02:00 on 2 January 2000,
the result would be 1.
</p>
<p>
Note that if either instance is a local clock time (type ClockTime),
the result cannot be guaranteed to be accurate, since by definition they
contain no information about time zones or daylight savings changes.
</p>
<p>
If one instance is date-only and the other is date-time, the date-time
value is first converted to the same time specification as the date-only
value, and the result is the difference in days between the resultant
date and the date-only date.
</p>
<p>
If both instances are date-only, the calculation ignores time zones.
</p>
<p>
</p><dl compact><dt><b>Parameters:</b></dt><dd>
<table border="0" cellspacing="2" cellpadding="0">
<tr><td></td><td valign="top"><em>other</em> </td><td> other date/time
</td></tr> </table></dl>
<p> <dl class="return" compact><dt><b>Returns:</b></dt><dd> number of days difference
</dd></dl> <dl class="see" compact><dt><b>See also:</b></dt><dd> secsTo(), addDays()
</dd></dl>
</p></div></div><a class="anchor" name="detach"></a>
<div class="memitem">
<div class="memproto">
<table class="memname"><tr>
<td class="memname"> detach</td>
<td>(</td>
<td class="paramtype"> </td>
<td class="paramname"><em>self</em> )</td>
<td width="100%"> </td>
</tr>
</table>
</div>
<div class="memdoc"><p>Create a separate copy of this instance's data if it is implicitly shared
with another instance.
</p>
<p>
You would normally only call this if you want different copies of the
same date/time value to cache conversions to different time zones. Because
only the last conversion to another time zone is cached, and the cached
value is implicitly shared, judicious use of detach() could improve
efficiency when handling several time zones. But take care: if used
inappropriately, it will reduce efficiency!
</p></div></div><a class="anchor" name="isClockTime"></a>
<div class="memitem">
<div class="memproto">
<table class="memname"><tr>
<td class="memname">bool isClockTime</td>
<td>(</td>
<td class="paramtype"> </td>
<td class="paramname"><em>self</em> )</td>
<td width="100%"> </td>
</tr>
</table>
</div>
<div class="memdoc"><p>Returns whether the date/time is a local clock time.
</p>
<p>
<dl class="return" compact><dt><b>Returns:</b></dt><dd> true if local clock time
</dd></dl> <dl class="see" compact><dt><b>See also:</b></dt><dd> isUtc(), timeZone()
</dd></dl>
</p></div></div><a class="anchor" name="isDateOnly"></a>
<div class="memitem">
<div class="memproto">
<table class="memname"><tr>
<td class="memname">bool isDateOnly</td>
<td>(</td>
<td class="paramtype"> </td>
<td class="paramname"><em>self</em> )</td>
<td width="100%"> </td>
</tr>
</table>
</div>
<div class="memdoc"><p>Returns whether the instance represents a date/time or a date-only value.
</p>
<p>
<dl class="return" compact><dt><b>Returns:</b></dt><dd> true if date-only, false if date and time
</dd></dl>
</p></div></div><a class="anchor" name="isLocalZone"></a>
<div class="memitem">
<div class="memproto">
<table class="memname"><tr>
<td class="memname">bool isLocalZone</td>
<td>(</td>
<td class="paramtype"> </td>
<td class="paramname"><em>self</em> )</td>
<td width="100%"> </td>
</tr>
</table>
</div>
<div class="memdoc"><p>Returns whether the time zone for the date/time is the current local
system time zone.
</p>
<p>
<dl class="return" compact><dt><b>Returns:</b></dt><dd> true if local system time zone
</dd></dl> <dl class="see" compact><dt><b>See also:</b></dt><dd> isUtc(), isOffsetFromUtc(), timeZone()
</dd></dl>
</p></div></div><a class="anchor" name="isNull"></a>
<div class="memitem">
<div class="memproto">
<table class="memname"><tr>
<td class="memname">bool isNull</td>
<td>(</td>
<td class="paramtype"> </td>
<td class="paramname"><em>self</em> )</td>
<td width="100%"> </td>
</tr>
</table>
</div>
<div class="memdoc"><p>Returns whether the date/time is null.
</p>
<p>
<dl class="return" compact><dt><b>Returns:</b></dt><dd> true if both date and time are null, else false
</dd></dl> <dl class="see" compact><dt><b>See also:</b></dt><dd> isValid(), QDateTime.isNull()
</dd></dl>
</p></div></div><a class="anchor" name="isOffsetFromUtc"></a>
<div class="memitem">
<div class="memproto">
<table class="memname"><tr>
<td class="memname">bool isOffsetFromUtc</td>
<td>(</td>
<td class="paramtype"> </td>
<td class="paramname"><em>self</em> )</td>
<td width="100%"> </td>
</tr>
</table>
</div>
<div class="memdoc"><p>Returns whether the date/time is a local time at a fixed offset from
UTC.
</p>
<p>
<dl class="return" compact><dt><b>Returns:</b></dt><dd> true if local time at fixed offset from UTC
</dd></dl> <dl class="see" compact><dt><b>See also:</b></dt><dd> isLocal(), isUtc(), utcOffset()
</dd></dl>
</p></div></div><a class="anchor" name="isSecondOccurrence"></a>
<div class="memitem">
<div class="memproto">
<table class="memname"><tr>
<td class="memname">bool isSecondOccurrence</td>
<td>(</td>
<td class="paramtype"> </td>
<td class="paramname"><em>self</em> )</td>
<td width="100%"> </td>
</tr>
</table>
</div>
<div class="memdoc"><p>Returns whether the date/time is the second occurrence of this time. This
is only applicable to a date/time expressed in terms of a time zone (type
TimeZone or LocalZone), around the time of change from daylight
savings to standard time.
</p>
<p>
When a shift from daylight savings time to standard time occurs, the local
times (typically the previous hour) immediately preceding the shift occur
twice. For example, if a time shift of 1 hour happens at 03:00, the clock
jumps backwards to 02:00, so the local times between 02:00:00 and 02:59:59
occur once before the shift, and again after the shift.
</p>
<p>
For instances which are not of type TimeZone, or when the date/time is
not near to a time shift, false is returned.
</p>
<p>
<dl class="return" compact><dt><b>Returns:</b></dt><dd> true if the time is the second occurrence, false otherwise
</dd></dl> <dl class="see" compact><dt><b>See also:</b></dt><dd> setSecondOccurrence()
</dd></dl>
</p></div></div><a class="anchor" name="isUtc"></a>
<div class="memitem">
<div class="memproto">
<table class="memname"><tr>
<td class="memname">bool isUtc</td>
<td>(</td>
<td class="paramtype"> </td>
<td class="paramname"><em>self</em> )</td>
<td width="100%"> </td>
</tr>
</table>
</div>
<div class="memdoc"><p>Returns whether the date/time is a UTC time.
It is considered to be a UTC time if it either has a UTC time
specification (SpecType == UTC), or has a zero offset from UTC
(SpecType == OffsetFromUTC with zero UTC offset).
</p>
<p>
<dl class="return" compact><dt><b>Returns:</b></dt><dd> true if UTC
</dd></dl> <dl class="see" compact><dt><b>See also:</b></dt><dd> isLocal(), isOffsetFromUtc(), timeZone()
</dd></dl>
</p></div></div><a class="anchor" name="isValid"></a>
<div class="memitem">
<div class="memproto">
<table class="memname"><tr>
<td class="memname">bool isValid</td>
<td>(</td>
<td class="paramtype"> </td>
<td class="paramname"><em>self</em> )</td>
<td width="100%"> </td>
</tr>
</table>
</div>
<div class="memdoc"><p>Returns whether the date/time is valid.
</p>
<p>
<dl class="return" compact><dt><b>Returns:</b></dt><dd> true if both date and time are valid, else false
</dd></dl> <dl class="see" compact><dt><b>See also:</b></dt><dd> isNull(), QDateTime.isValid()
</dd></dl>
</p></div></div><a class="anchor" name="operator !="></a>
<div class="memitem">
<div class="memproto">
<table class="memname"><tr>
<td class="memname">bool operator !=</td>
<td>(</td>
<td class="paramtype"> <em>self</em>, </td>
<td class="paramname"></td>
</tr><tr>
<td class="memname"></td>
<td></td>
<td class="paramtype"><a href="../kdecore/KDateTime.html">KDateTime</a> </td>
<td class="paramname"><em>other</em></td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td>
<td></td>
<td width="100%"> </td>
</tr></table>
</div>
<div class="memdoc"></div></div><a class="anchor" name="operator <"></a>
<div class="memitem">
<div class="memproto">
<table class="memname"><tr>
<td class="memname">bool operator <</td>
<td>(</td>
<td class="paramtype"> <em>self</em>, </td>
<td class="paramname"></td>
</tr><tr>
<td class="memname"></td>
<td></td>
<td class="paramtype"><a href="../kdecore/KDateTime.html">KDateTime</a> </td>
<td class="paramname"><em>other</em></td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td>
<td></td>
<td width="100%"> </td>
</tr></table>
</div>
<div class="memdoc"><p>Check whether this date/time is earlier than another.
The comparison takes time zones into account: if the two instances have
different time zones, they are first converted to UTC before comparing.
</p>
<p>
Note that if either instance is a local clock time (type ClockTime),
the result cannot be guaranteed to be correct, since by definition they
contain no information about time zones or daylight savings changes.
</p>
<p>
If one or both instances are date-only, the comparison returns true if
this date/time or day, falls wholly before the other date/time or
day. To achieve this, the time used in the comparison is the end of day
(if this instance is date-only) or the start of day (if the other
instance is date-only).
</p>
<p>
<dl class="return" compact><dt><b>Returns:</b></dt><dd> true if this instance represents an earlier time than <b>other,</b>
</dd></dl> false otherwise
<dl class="see" compact><dt><b>See also:</b></dt><dd> compare()
</dd></dl>
</p></div></div><a class="anchor" name="operator <="></a>
<div class="memitem">
<div class="memproto">
<table class="memname"><tr>
<td class="memname">bool operator <=</td>
<td>(</td>
<td class="paramtype"> <em>self</em>, </td>
<td class="paramname"></td>
</tr><tr>
<td class="memname"></td>
<td></td>
<td class="paramtype"><a href="../kdecore/KDateTime.html">KDateTime</a> </td>
<td class="paramname"><em>other</em></td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td>
<td></td>
<td width="100%"> </td>
</tr></table>
</div>
<div class="memdoc"></div></div><a class="anchor" name="operator =="></a>
<div class="memitem">
<div class="memproto">
<table class="memname"><tr>
<td class="memname">bool operator ==</td>
<td>(</td>
<td class="paramtype"> <em>self</em>, </td>
<td class="paramname"></td>
</tr><tr>
<td class="memname"></td>
<td></td>
<td class="paramtype"><a href="../kdecore/KDateTime.html">KDateTime</a> </td>
<td class="paramname"><em>other</em></td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td>
<td></td>
<td width="100%"> </td>
</tr></table>
</div>
<div class="memdoc"><p>Check whether this date/time is simultaneous with another.
The comparison takes time zones into account: if the two instances have
different time zones, they are first converted to UTC before comparing.
</p>
<p>
Note that if either instance is a local clock time (type ClockTime),
the result cannot be guaranteed to be correct, since by definition they
contain no information about time zones or daylight savings changes.
</p>
<p>
If one instance is date-only and the other is date/time, they are
considered unequal.
</p>
<p>
If both instances are date-only, they are considered simultaneous if both
their start of day and end of day times are simultaneous with each
other. (Both start and end of day times need to be considered in case a
daylight saving change occurs during that day.)
</p>
<p>
<dl class="return" compact><dt><b>Returns:</b></dt><dd> true if the two instances represent the same time, false otherwise
</dd></dl> <dl class="see" compact><dt><b>See also:</b></dt><dd> compare()
</dd></dl>
</p></div></div><a class="anchor" name="operator >"></a>
<div class="memitem">
<div class="memproto">
<table class="memname"><tr>
<td class="memname">bool operator ></td>
<td>(</td>
<td class="paramtype"> <em>self</em>, </td>
<td class="paramname"></td>
</tr><tr>
<td class="memname"></td>
<td></td>
<td class="paramtype"><a href="../kdecore/KDateTime.html">KDateTime</a> </td>
<td class="paramname"><em>other</em></td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td>
<td></td>
<td width="100%"> </td>
</tr></table>
</div>
<div class="memdoc"></div></div><a class="anchor" name="operator >="></a>
<div class="memitem">
<div class="memproto">
<table class="memname"><tr>
<td class="memname">bool operator >=</td>
<td>(</td>
<td class="paramtype"> <em>self</em>, </td>
<td class="paramname"></td>
</tr><tr>
<td class="memname"></td>
<td></td>
<td class="paramtype"><a href="../kdecore/KDateTime.html">KDateTime</a> </td>
<td class="paramname"><em>other</em></td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td>
<td></td>
<td width="100%"> </td>
</tr></table>
</div>
<div class="memdoc"></div></div><a class="anchor" name="outOfRange"></a>
<div class="memitem">
<div class="memproto">
<table class="memname"><tr>
<td class="memname">bool outOfRange</td>
<td>(</td>
<td class="paramtype"> </td>
<td class="paramname"><em>self</em> )</td>
<td width="100%"> </td>
</tr>
</table>
</div>
<div class="memdoc"><p>Checks whether the date/time returned by the last call to fromString()
was invalid because an otherwise valid date was outside the range which
can be represented by QDate. This status occurs when fromString() read
a valid string containing a year earlier than -4712 (4713 BC). On exit
from fromString(), if outOfRange() returns true, isValid() will
return false.
</p>
<p>
<dl class="return" compact><dt><b>Returns:</b></dt><dd> true if date was earlier than -4712, else false
</dd></dl> <dl class="see" compact><dt><b>See also:</b></dt><dd> isValid(), fromString()
</dd></dl>
</p></div></div><a class="anchor" name="secsTo"></a>
<div class="memitem">
<div class="memproto">
<table class="memname"><tr>
<td class="memname">int secsTo</td>
<td>(</td>
<td class="paramtype"> <em>self</em>, </td>
<td class="paramname"></td>
</tr><tr>
<td class="memname"></td>
<td></td>
<td class="paramtype"><a href="../kdecore/KDateTime.html">KDateTime</a> </td>
<td class="paramname"><em>other</em></td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td>
<td></td>
<td width="100%"> </td>
</tr></table>
</div>
<div class="memdoc"><p>Returns the number of seconds from this date/time to the <b>other</b> date/time.
</p>
<p>
Before performing the comparison, the two date/times are converted to UTC
to ensure that the result is correct if one of the two date/times has
daylight saving time (DST) and the other doesn't. The exception is when
both instances are local clock time, in which case no conversion to UTC
is done.
</p>
<p>
Note that if either instance is a local clock time (type ClockTime),
the result cannot be guaranteed to be accurate, since by definition they
contain no information about time zones or daylight savings changes.
</p>
<p>
If one instance is date-only and the other is date-time, the date-time
value is first converted to the same time specification as the date-only
value, and the result is the difference in days between the resultant
date and the date-only date.
</p>
<p>
If both instances are date-only, the result is the difference in days
between the two dates, ignoring time zones.
</p>
<p>
</p><dl compact><dt><b>Parameters:</b></dt><dd>
<table border="0" cellspacing="2" cellpadding="0">
<tr><td></td><td valign="top"><em>other</em> </td><td> other date/time
</td></tr> </table></dl>
<p> <dl class="return" compact><dt><b>Returns:</b></dt><dd> number of seconds difference
</dd></dl> <dl class="see" compact><dt><b>See also:</b></dt><dd> secsTo_long(), addSecs(), daysTo()
</dd></dl>
</p></div></div><a class="anchor" name="secsTo_long"></a>
<div class="memitem">
<div class="memproto">
<table class="memname"><tr>
<td class="memname">long secsTo_long</td>
<td>(</td>
<td class="paramtype"> <em>self</em>, </td>
<td class="paramname"></td>
</tr><tr>
<td class="memname"></td>
<td></td>
<td class="paramtype"><a href="../kdecore/KDateTime.html">KDateTime</a> </td>
<td class="paramname"><em>other</em></td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td>
<td></td>
<td width="100%"> </td>
</tr></table>
</div>
<div class="memdoc"><p>Returns the number of seconds from this date/time to the <b>other</b> date/time.
</p>
<p>
Before performing the comparison, the two date/times are converted to UTC
to ensure that the result is correct if one of the two date/times has
daylight saving time (DST) and the other doesn't. The exception is when
both instances are local clock time, in which case no conversion to UTC
is done.
</p>
<p>
Note that if either instance is a local clock time (type ClockTime),
the result cannot be guaranteed to be accurate, since by definition they
contain no information about time zones or daylight savings changes.
</p>
<p>
If one instance is date-only and the other is date-time, the date-time
value is first converted to the same time specification as the date-only
value, and the result is the difference in days between the resultant
date and the date-only date.
</p>
<p>
If both instances are date-only, the result is the difference in days
between the two dates, ignoring time zones.
</p>
<p>
</p><dl compact><dt><b>Parameters:</b></dt><dd>
<table border="0" cellspacing="2" cellpadding="0">
<tr><td></td><td valign="top"><em>other</em> </td><td> other date/time
</td></tr> </table></dl>
<p> <dl class="return" compact><dt><b>Returns:</b></dt><dd> number of seconds difference
</dd></dl> <dl class="see" compact><dt><b>See also:</b></dt><dd> secsTo(), addSecs(), daysTo()
</dd></dl>
</p></div></div><a class="anchor" name="setDate"></a>
<div class="memitem">
<div class="memproto">
<table class="memname"><tr>
<td class="memname"> setDate</td>
<td>(</td>
<td class="paramtype"> <em>self</em>, </td>
<td class="paramname"></td>
</tr><tr>
<td class="memname"></td>
<td></td>
<td class="paramtype">QDate </td>
<td class="paramname"><em>date</em></td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td>
<td></td>
<td width="100%"> </td>
</tr></table>
</div>
<div class="memdoc"><p>Sets the date part of the date/time.
</p>
<p>
</p><dl compact><dt><b>Parameters:</b></dt><dd>
<table border="0" cellspacing="2" cellpadding="0">
<tr><td></td><td valign="top"><em>date</em> </td><td> new date value
</td></tr> </table></dl>
<p> <dl class="see" compact><dt><b>See also:</b></dt><dd> date(), setTime(), setTimeSpec(), setTime_t(), setDateOnly()
</dd></dl>
</p></div></div><a class="anchor" name="setDateOnly"></a>
<div class="memitem">
<div class="memproto">
<table class="memname"><tr>
<td class="memname"> setDateOnly</td>
<td>(</td>
<td class="paramtype"> <em>self</em>, </td>
<td class="paramname"></td>
</tr><tr>
<td class="memname"></td>
<td></td>
<td class="paramtype">bool </td>
<td class="paramname"><em>dateOnly</em></td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td>
<td></td>
<td width="100%"> </td>
</tr></table>
</div>
<div class="memdoc"><p>Sets the instance either to being a date and time value, or a date-only
value. If its status is changed to date-only, its time is set to
00:00:00.
</p>
<p>
</p><dl compact><dt><b>Parameters:</b></dt><dd>
<table border="0" cellspacing="2" cellpadding="0">
<tr><td></td><td valign="top"><em>dateOnly</em> </td><td> true to set to date-only, false to set to date
and time.
</td></tr> </table></dl>
<p> <dl class="see" compact><dt><b>See also:</b></dt><dd> isDateOnly(), setTime()
</dd></dl>
</p></div></div><a class="anchor" name="setDateTime"></a>
<div class="memitem">
<div class="memproto">
<table class="memname"><tr>
<td class="memname"> setDateTime</td>
<td>(</td>
<td class="paramtype"> <em>self</em>, </td>
<td class="paramname"></td>
</tr><tr>
<td class="memname"></td>
<td></td>
<td class="paramtype">QDateTime </td>
<td class="paramname"><em>dt</em></td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td>
<td></td>
<td width="100%"> </td>
</tr></table>
</div>
<div class="memdoc"><p>Sets the date/time part of the instance, leaving the time specification
unaffected.
</p>
<p>
If <b>dt</b> is a local time (\code dt.timeSpec() == Qt.LocalTime \endcode)
and the instance is UTC, <b>dt</b> is first converted from the current
system time zone to UTC before being stored.
</p>
<p>
If the instance was date-only, it is changed to being a date and time
value.
</p>
<p>
</p><dl compact><dt><b>Parameters:</b></dt><dd>
<table border="0" cellspacing="2" cellpadding="0">
<tr><td></td><td valign="top"><em>dt</em> </td><td> date and time
</td></tr> </table></dl>
<p> <dl class="see" compact><dt><b>See also:</b></dt><dd> dateTime(), setDate(), setTime(), setTimeSpec()
</dd></dl>
</p></div></div><a class="anchor" name="setSecondOccurrence"></a>
<div class="memitem">
<div class="memproto">
<table class="memname"><tr>
<td class="memname"> setSecondOccurrence</td>
<td>(</td>
<td class="paramtype"> <em>self</em>, </td>
<td class="paramname"></td>
</tr><tr>
<td class="memname"></td>
<td></td>
<td class="paramtype">bool </td>
<td class="paramname"><em>second</em></td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td>
<td></td>
<td width="100%"> </td>
</tr></table>
</div>
<div class="memdoc"><p>Sets whether the date/time is the second occurrence of this time. This
is only applicable to a date/time expressed in terms of a time zone (type
TimeZone or LocalZone), around the time of change from daylight
savings to standard time.
</p>
<p>
When a shift from daylight savings time to standard time occurs, the local
times (typically the previous hour) immediately preceding the shift occur
twice. For example, if a time shift of 1 hour happens at 03:00, the clock
jumps backwards to 02:00, so the local times between 02:00:00 and 02:59:59
occur once before the shift, and again after the shift.
</p>
<p>
For instances which are not of type TimeZone, or when the date/time is
not near to a time shift, calling this method has no effect.
</p>
<p>
Note that most other setting methods clear the second occurrence indicator,
so if you want to retain its setting, you must call setSecondOccurrence()
again after changing the instance's value.
</p>
<p>
</p><dl compact><dt><b>Parameters:</b></dt><dd>
<table border="0" cellspacing="2" cellpadding="0">
<tr><td></td><td valign="top"><em>second</em> </td><td> true to set as the second occurrence, false to set as
the first occurrence
</td></tr> </table></dl>
<p> <dl class="see" compact><dt><b>See also:</b></dt><dd> isSecondOccurrence()
</dd></dl>
</p></div></div><a class="anchor" name="setTime"></a>
<div class="memitem">
<div class="memproto">
<table class="memname"><tr>
<td class="memname"> setTime</td>
<td>(</td>
<td class="paramtype"> <em>self</em>, </td>
<td class="paramname"></td>
</tr><tr>
<td class="memname"></td>
<td></td>
<td class="paramtype">QTime </td>
<td class="paramname"><em>time</em></td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td>
<td></td>
<td width="100%"> </td>
</tr></table>
</div>
<div class="memdoc"><p>Sets the time part of the date/time. If the instance was date-only, it
is changed to being a date and time value.
</p>
<p>
</p><dl compact><dt><b>Parameters:</b></dt><dd>
<table border="0" cellspacing="2" cellpadding="0">
<tr><td></td><td valign="top"><em>time</em> </td><td> new time value
</td></tr> </table></dl>
<p> <dl class="see" compact><dt><b>See also:</b></dt><dd> time(), setDate(), setTimeSpec(), setTime_t()
</dd></dl>
</p></div></div><a class="anchor" name="setTimeSpec"></a>
<div class="memitem">
<div class="memproto">
<table class="memname"><tr>
<td class="memname"> setTimeSpec</td>
<td>(</td>
<td class="paramtype"> <em>self</em>, </td>
<td class="paramname"></td>
</tr><tr>
<td class="memname"></td>
<td></td>
<td class="paramtype"><a href="../kdecore/KDateTime.Spec.html">KDateTime.Spec</a> </td>
<td class="paramname"><em>spec</em></td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td>
<td></td>
<td width="100%"> </td>
</tr></table>
</div>
<div class="memdoc"><p>Changes the time specification of the instance.
</p>
<p>
Any previous time zone is forgotten. The stored date/time component of
the instance is left unchanged (except that its UTC/local time setting
is set to correspond with <b>spec).</b> Usually this method will change the
absolute time which this instance represents.
</p>
<p>
</p><dl compact><dt><b>Parameters:</b></dt><dd>
<table border="0" cellspacing="2" cellpadding="0">
<tr><td></td><td valign="top"><em>spec</em> </td><td> new time specification
</td></tr> </table></dl>
<p> <dl class="see" compact><dt><b>See also:</b></dt><dd> timeSpec(), timeZone()
</dd></dl>
</p></div></div><a class="anchor" name="setTime_t"></a>
<div class="memitem">
<div class="memproto">
<table class="memname"><tr>
<td class="memname"> setTime_t</td>
<td>(</td>
<td class="paramtype"> <em>self</em>, </td>
<td class="paramname"></td>
</tr><tr>
<td class="memname"></td>
<td></td>
<td class="paramtype">long </td>
<td class="paramname"><em>seconds</em></td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td>
<td></td>
<td width="100%"> </td>
</tr></table>
</div>
<div class="memdoc"><p>Sets the time to a UTC time, specified as seconds since 00:00:00 UTC
1st January 1970 (as returned by time(2)).
</p>
<p>
</p><dl compact><dt><b>Parameters:</b></dt><dd>
<table border="0" cellspacing="2" cellpadding="0">
<tr><td></td><td valign="top"><em>seconds</em> </td><td> number of seconds since 00:00:00 UTC 1st January 1970
</td></tr> </table></dl>
<p> <dl class="see" compact><dt><b>See also:</b></dt><dd> toTime_t()
</dd></dl>
</p></div></div><a class="anchor" name="time"></a>
<div class="memitem">
<div class="memproto">
<table class="memname"><tr>
<td class="memname">QTime time</td>
<td>(</td>
<td class="paramtype"> </td>
<td class="paramname"><em>self</em> )</td>
<td width="100%"> </td>
</tr>
</table>
</div>
<div class="memdoc"><p>Returns the time part of the date/time. The value returned should be
interpreted in terms of the instance's time zone or UTC offset. If
the instance is date-only, the time returned is 00:00:00.
</p>
<p>
<dl class="return" compact><dt><b>Returns:</b></dt><dd> time value
</dd></dl> <dl class="see" compact><dt><b>See also:</b></dt><dd> date(), dateTime(), isDateOnly()
</dd></dl>
</p></div></div><a class="anchor" name="timeSpec"></a>
<div class="memitem">
<div class="memproto">
<table class="memname"><tr>
<td class="memname"><a href="../kdecore/KDateTime.Spec.html">KDateTime.Spec</a> timeSpec</td>
<td>(</td>
<td class="paramtype"> </td>
<td class="paramname"><em>self</em> )</td>
<td width="100%"> </td>
</tr>
</table>
</div>
<div class="memdoc"><p>Returns the time specification of the date/time, i.e. whether it is
UTC, what time zone it is, etc.
</p>
<p>
<dl class="return" compact><dt><b>Returns:</b></dt><dd> time specification
</dd></dl> <dl class="see" compact><dt><b>See also:</b></dt><dd> isLocalZone(), isClockTime(), isUtc(), timeZone()
</dd></dl>
</p></div></div><a class="anchor" name="timeType"></a>
<div class="memitem">
<div class="memproto">
<table class="memname"><tr>
<td class="memname"><a href="../kdecore/KDateTime.html#SpecType">KDateTime.SpecType</a> timeType</td>
<td>(</td>
<td class="paramtype"> </td>
<td class="paramname"><em>self</em> )</td>
<td width="100%"> </td>
</tr>
</table>
</div>
<div class="memdoc"><p>Returns the time specification type of the date/time, i.e. whether it is
UTC, has a time zone, etc. If the type is the local time zone,
TimeZone is returned; use isLocalZone() to check for the local time
zone.
</p>
<p>
<dl class="return" compact><dt><b>Returns:</b></dt><dd> specification type
</dd></dl> <dl class="see" compact><dt><b>See also:</b></dt><dd> timeSpec(), isLocalZone(), isClockTime(), isUtc(), timeZone()
</dd></dl>
</p></div></div><a class="anchor" name="timeZone"></a>
<div class="memitem">
<div class="memproto">
<table class="memname"><tr>
<td class="memname"><a href="../kdecore/KTimeZone.html">KTimeZone</a> timeZone</td>
<td>(</td>
<td class="paramtype"> </td>
<td class="paramname"><em>self</em> )</td>
<td width="100%"> </td>
</tr>
</table>
</div>
<div class="memdoc"><p>Returns the time zone for the date/time. If the date/time is specified
as a UTC time, a UTC time zone is always returned.
</p>
<p>
<dl class="return" compact><dt><b>Returns:</b></dt><dd> time zone, or invalid if a local time at a fixed UTC offset or a
local clock time
</dd></dl> <dl class="see" compact><dt><b>See also:</b></dt><dd> isUtc(), isLocal()
</dd></dl>
</p></div></div><a class="anchor" name="toClockTime"></a>
<div class="memitem">
<div class="memproto">
<table class="memname"><tr>
<td class="memname"><a href="../kdecore/KDateTime.html">KDateTime</a> toClockTime</td>
<td>(</td>
<td class="paramtype"> </td>
<td class="paramname"><em>self</em> )</td>
<td width="100%"> </td>
</tr>
</table>
</div>
<div class="memdoc"><p>Returns the time converted to the local clock time. The time is first
converted to the local system time zone before setting its type to
ClockTime, i.e. no associated time zone.
If the instance is a date-only value, a date-only clock time value is
returned, with the date unchanged.
</p>
<p>
<dl class="return" compact><dt><b>Returns:</b></dt><dd> converted time
</dd></dl> <dl class="see" compact><dt><b>See also:</b></dt><dd> toLocalZone(), toTimeSpec()
</dd></dl>
</p></div></div><a class="anchor" name="toLocalZone"></a>
<div class="memitem">
<div class="memproto">
<table class="memname"><tr>
<td class="memname"><a href="../kdecore/KDateTime.html">KDateTime</a> toLocalZone</td>
<td>(</td>
<td class="paramtype"> </td>
<td class="paramname"><em>self</em> )</td>
<td width="100%"> </td>
</tr>
</table>
</div>
<div class="memdoc"><p>Returns the time converted to the current local system time zone.
If the instance is a date-only value, a date-only local time zone value
is returned, with the date unchanged.
</p>
<p>
<dl class="return" compact><dt><b>Returns:</b></dt><dd> converted time
</dd></dl> <dl class="see" compact><dt><b>See also:</b></dt><dd> toUtc(), toOffsetFromUtc(), toZone(), toTimeSpec(), KTimeZone.convert()
</dd></dl>
</p></div></div><a class="anchor" name="toOffsetFromUtc"></a>
<div class="memitem">
<div class="memproto">
<table class="memname"><tr>
<td class="memname"><a href="../kdecore/KDateTime.html">KDateTime</a> toOffsetFromUtc</td>
<td>(</td>
<td class="paramtype"> </td>
<td class="paramname"><em>self</em> )</td>
<td width="100%"> </td>
</tr>
</table>
</div>
<div class="memdoc"><p>Returns the time expressed as a specified offset from UTC.
</p>
<p>
If the instance is a local clock time, it is first set to the local time
zone, and then converted to the UTC offset.
If the instance is a date-only value, a date-only clock time value is
returned, with the date unchanged.
</p>
<p>
</p><dl compact><dt><b>Parameters:</b></dt><dd>
<table border="0" cellspacing="2" cellpadding="0">
<tr><td></td><td valign="top"><em>utcOffset</em> </td><td> number of seconds to add to UTC to get the local time.
</td></tr> </table></dl>
<p> <dl class="return" compact><dt><b>Returns:</b></dt><dd> converted time
</dd></dl> <dl class="see" compact><dt><b>See also:</b></dt><dd> toUtc(), toOffsetFromUtc(), toLocalZone(), toZone(), toTimeSpec(), toTime_t(), KTimeZone.convert()
</dd></dl>
</p></div></div><a class="anchor" name="toOffsetFromUtc"></a>
<div class="memitem">
<div class="memproto">
<table class="memname"><tr>
<td class="memname"><a href="../kdecore/KDateTime.html">KDateTime</a> toOffsetFromUtc</td>
<td>(</td>
<td class="paramtype"> <em>self</em>, </td>
<td class="paramname"></td>
</tr><tr>
<td class="memname"></td>
<td></td>
<td class="paramtype">int </td>
<td class="paramname"><em>utcOffset</em></td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td>
<td></td>
<td width="100%"> </td>
</tr></table>
</div>
<div class="memdoc"><p>Returns the time expressed as a specified offset from UTC.
</p>
<p>
If the instance is a local clock time, it is first set to the local time
zone, and then converted to the UTC offset.
If the instance is a date-only value, a date-only clock time value is
returned, with the date unchanged.
</p>
<p>
</p><dl compact><dt><b>Parameters:</b></dt><dd>
<table border="0" cellspacing="2" cellpadding="0">
<tr><td></td><td valign="top"><em>utcOffset</em> </td><td> number of seconds to add to UTC to get the local time.
</td></tr> </table></dl>
<p> <dl class="return" compact><dt><b>Returns:</b></dt><dd> converted time
</dd></dl> <dl class="see" compact><dt><b>See also:</b></dt><dd> toUtc(), toOffsetFromUtc(), toLocalZone(), toZone(), toTimeSpec(), toTime_t(), KTimeZone.convert()
</dd></dl>
</p></div></div><a class="anchor" name="toString"></a>
<div class="memitem">
<div class="memproto">
<table class="memname"><tr>
<td class="memname">QString toString</td>
<td>(</td>
<td class="paramtype"> <em>self</em>, </td>
<td class="paramname"></td>
</tr><tr>
<td class="memname"></td>
<td></td>
<td class="paramtype">QString </td>
<td class="paramname"><em>format</em></td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td>
<td></td>
<td width="100%"> </td>
</tr></table>
</div>
<div class="memdoc"><p>Returns the date/time as a string, formatted according to the <b>format</b>
parameter, with the UTC offset appended.
</p>
<p>
Note that if the instance has a time specification of ClockTime, the UTC
offset in the result will be blank, except for RFC 2822 and RFC 3339
formats in which it will be the offset for the local system time zone.
</p>
<p>
If the instance is date-only, the time will when <b>format</b> permits be
omitted from the output string. This applies to <b>format</b> = QtTextDate
or LocalDate. It also applies to <b>format</b> = ISODate when the instance
has a time specification of ClockTime. For all other cases, a time of
00:00:00 will be output.
</p>
<p>
For RFC 2822 format, set <b>format</b> to RFCDateDay to include the day
of the week, or to RFCDate to omit it.
</p>
<p>
</p><dl compact><dt><b>Parameters:</b></dt><dd>
<table border="0" cellspacing="2" cellpadding="0">
<tr><td></td><td valign="top"><em>format</em> </td><td> format for output string
</td></tr> </table></dl>
<p> <dl class="return" compact><dt><b>Returns:</b></dt><dd> formatted string
</dd></dl> <dl class="see" compact><dt><b>See also:</b></dt><dd> fromString(), QDateTime.toString()
</dd></dl>
</p></div></div><a class="anchor" name="toString"></a>
<div class="memitem">
<div class="memproto">
<table class="memname"><tr>
<td class="memname">QString toString</td>
<td>(</td>
<td class="paramtype"> <em>self</em>, </td>
<td class="paramname"></td>
</tr><tr>
<td class="memname"></td>
<td></td>
<td class="paramtype"><a href="../kdecore/KDateTime.html#TimeFormat">KDateTime.TimeFormat</a> </td>
<td class="paramname"><em>format=KDateTime.ISODate</em></td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td>
<td></td>
<td width="100%"> </td>
</tr></table>
</div>
<div class="memdoc"><p>Returns the date/time as a string, formatted according to the <b>format</b>
parameter, with the UTC offset appended.
</p>
<p>
Note that if the instance has a time specification of ClockTime, the UTC
offset in the result will be blank, except for RFC 2822 and RFC 3339
formats in which it will be the offset for the local system time zone.
</p>
<p>
If the instance is date-only, the time will when <b>format</b> permits be
omitted from the output string. This applies to <b>format</b> = QtTextDate
or LocalDate. It also applies to <b>format</b> = ISODate when the instance
has a time specification of ClockTime. For all other cases, a time of
00:00:00 will be output.
</p>
<p>
For RFC 2822 format, set <b>format</b> to RFCDateDay to include the day
of the week, or to RFCDate to omit it.
</p>
<p>
</p><dl compact><dt><b>Parameters:</b></dt><dd>
<table border="0" cellspacing="2" cellpadding="0">
<tr><td></td><td valign="top"><em>format</em> </td><td> format for output string
</td></tr> </table></dl>
<p> <dl class="return" compact><dt><b>Returns:</b></dt><dd> formatted string
</dd></dl> <dl class="see" compact><dt><b>See also:</b></dt><dd> fromString(), QDateTime.toString()
</dd></dl>
</p></div></div><a class="anchor" name="toTimeSpec"></a>
<div class="memitem">
<div class="memproto">
<table class="memname"><tr>
<td class="memname"><a href="../kdecore/KDateTime.html">KDateTime</a> toTimeSpec</td>
<td>(</td>
<td class="paramtype"> <em>self</em>, </td>
<td class="paramname"></td>
</tr><tr>
<td class="memname"></td>
<td></td>
<td class="paramtype"><a href="../kdecore/KDateTime.Spec.html">KDateTime.Spec</a> </td>
<td class="paramname"><em>spec</em></td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td>
<td></td>
<td width="100%"> </td>
</tr></table>
</div>
<div class="memdoc"><p>Returns the time converted to the time specification of another instance.
If this instance is a local clock time, it is first set to the local time
zone, and then converted to the <b>spec</b> time specification.
If this instance is a date-only value, a date-only value is returned,
with the date unchanged.
</p>
<p>
</p><dl compact><dt><b>Parameters:</b></dt><dd>
<table border="0" cellspacing="2" cellpadding="0">
<tr><td></td><td valign="top"><em>dt</em> </td><td> instance providing the new time specification
</td></tr> </table></dl>
<p> <dl class="return" compact><dt><b>Returns:</b></dt><dd> converted time
</dd></dl> <dl class="see" compact><dt><b>See also:</b></dt><dd> toLocalZone(), toUtc(), toOffsetFromUtc(), toZone(), KTimeZone.convert()
</dd></dl>
</p></div></div><a class="anchor" name="toTimeSpec"></a>
<div class="memitem">
<div class="memproto">
<table class="memname"><tr>
<td class="memname"><a href="../kdecore/KDateTime.html">KDateTime</a> toTimeSpec</td>
<td>(</td>
<td class="paramtype"> <em>self</em>, </td>
<td class="paramname"></td>
</tr><tr>
<td class="memname"></td>
<td></td>
<td class="paramtype"><a href="../kdecore/KDateTime.html">KDateTime</a> </td>
<td class="paramname"><em>dt</em></td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td>
<td></td>
<td width="100%"> </td>
</tr></table>
</div>
<div class="memdoc"><p>Returns the time converted to the time specification of another instance.
If this instance is a local clock time, it is first set to the local time
zone, and then converted to the <b>spec</b> time specification.
If this instance is a date-only value, a date-only value is returned,
with the date unchanged.
</p>
<p>
</p><dl compact><dt><b>Parameters:</b></dt><dd>
<table border="0" cellspacing="2" cellpadding="0">
<tr><td></td><td valign="top"><em>dt</em> </td><td> instance providing the new time specification
</td></tr> </table></dl>
<p> <dl class="return" compact><dt><b>Returns:</b></dt><dd> converted time
</dd></dl> <dl class="see" compact><dt><b>See also:</b></dt><dd> toLocalZone(), toUtc(), toOffsetFromUtc(), toZone(), KTimeZone.convert()
</dd></dl>
</p></div></div><a class="anchor" name="toTime_t"></a>
<div class="memitem">
<div class="memproto">
<table class="memname"><tr>
<td class="memname">long toTime_t</td>
<td>(</td>
<td class="paramtype"> </td>
<td class="paramname"><em>self</em> )</td>
<td width="100%"> </td>
</tr>
</table>
</div>
<div class="memdoc"><p>Converts the time to a UTC time, measured in seconds since 00:00:00 UTC
1st January 1970 (as returned by time(2)).
</p>
<p>
<dl class="return" compact><dt><b>Returns:</b></dt><dd> converted time, or uint(-1) if the date is out of range or invalid
</dd></dl> <dl class="see" compact><dt><b>See also:</b></dt><dd> setTime_t()
</dd></dl>
</p></div></div><a class="anchor" name="toUtc"></a>
<div class="memitem">
<div class="memproto">
<table class="memname"><tr>
<td class="memname"><a href="../kdecore/KDateTime.html">KDateTime</a> toUtc</td>
<td>(</td>
<td class="paramtype"> </td>
<td class="paramname"><em>self</em> )</td>
<td width="100%"> </td>
</tr>
</table>
</div>
<div class="memdoc"><p>Returns the time converted to UTC. The converted time has a UTC offset
of zero.
If the instance is a local clock time, it is first set to the local time
zone, and then converted to UTC.
If the instance is a date-only value, a date-only UTC value is returned,
with the date unchanged.
</p>
<p>
<dl class="return" compact><dt><b>Returns:</b></dt><dd> converted time
</dd></dl> <dl class="see" compact><dt><b>See also:</b></dt><dd> toOffsetFromUtc(), toLocalZone(), toZone(), toTimeSpec(), toTime_t(), KTimeZone.convert()
</dd></dl>
</p></div></div><a class="anchor" name="toZone"></a>
<div class="memitem">
<div class="memproto">
<table class="memname"><tr>
<td class="memname"><a href="../kdecore/KDateTime.html">KDateTime</a> toZone</td>
<td>(</td>
<td class="paramtype"> <em>self</em>, </td>
<td class="paramname"></td>
</tr><tr>
<td class="memname"></td>
<td></td>
<td class="paramtype"><a href="../kdecore/KTimeZone.html">KTimeZone</a> </td>
<td class="paramname"><em>zone</em></td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td>
<td></td>
<td width="100%"> </td>
</tr></table>
</div>
<div class="memdoc"><p>Returns the time converted to a specified time zone.
If the instance is a local clock time, it is first set to the local time
zone, and then converted to <b>zone.</b>
If the instance is a date-only value, a date-only value in <b>zone</b> is
returned, with the date unchanged.
</p>
<p>
</p><dl compact><dt><b>Parameters:</b></dt><dd>
<table border="0" cellspacing="2" cellpadding="0">
<tr><td></td><td valign="top"><em>zone</em> </td><td> time zone to convert to
</td></tr> </table></dl>
<p> <dl class="return" compact><dt><b>Returns:</b></dt><dd> converted time
</dd></dl> <dl class="see" compact><dt><b>See also:</b></dt><dd> toUtc(), toOffsetFromUtc(), toLocalZone(), toTimeSpec(), KTimeZone.convert()
</dd></dl>
</p></div></div><a class="anchor" name="utcOffset"></a>
<div class="memitem">
<div class="memproto">
<table class="memname"><tr>
<td class="memname">int utcOffset</td>
<td>(</td>
<td class="paramtype"> </td>
<td class="paramname"><em>self</em> )</td>
<td width="100%"> </td>
</tr>
</table>
</div>
<div class="memdoc"><p>Returns the UTC offset associated with the date/time. The UTC offset is
the number of seconds to add to UTC to get the local time.
</p>
<p>
<dl class="return" compact><dt><b>Returns:</b></dt><dd> UTC offset in seconds, or 0 if local clock time
</dd></dl> <dl class="see" compact><dt><b>See also:</b></dt><dd> isClockTime()
</dd></dl>
</p></div></div><hr><h2>Static Method Documentation</h2><a class="anchor" name="currentDateTime"></a>
<div class="memitem">
<div class="memproto">
<table class="memname"><tr>
<td class="memname"><a href="../kdecore/KDateTime.html">KDateTime</a> currentDateTime</td>
<td>(</td>
<td class="paramtype"><a href="../kdecore/KDateTime.Spec.html">KDateTime.Spec</a> </td>
<td class="paramname"><em>spec</em></td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td>
<td></td>
<td width="100%"> </td>
</tr></table>
</div>
<div class="memdoc"><p>Returns the current date and time, as reported by the system clock,
expressed in a given time specification.
</p>
<p>
<dl class="note" compact><dt><b>Note:</b></dt><dd> To fetch the current date and time expressed in UTC or in the local
system time zone, it is more efficient to use currentUtcDateTime() or
currentLocalDateTime().
</dd></dl> </p>
<p>
</p><dl compact><dt><b>Parameters:</b></dt><dd>
<table border="0" cellspacing="2" cellpadding="0">
<tr><td></td><td valign="top"><em>spec</em> </td><td> time specification
</td></tr> </table></dl>
<p> <dl class="return" compact><dt><b>Returns:</b></dt><dd> current date/time
</dd></dl> <dl class="see" compact><dt><b>See also:</b></dt><dd> currentUtcDateTime(), currentLocalDateTime()
</dd></dl>
</p></div></div><a class="anchor" name="currentLocalDate"></a>
<div class="memitem">
<div class="memproto">
<table class="memname"><tr>
<td class="memname">QDate currentLocalDate</td>
<td>(</td>
<td class="paramtype"> </td>
<td class="paramname">)</td>
<td width="100%"> </td>
</tr>
</table>
</div>
<div class="memdoc"><p>Returns the current date in the local time zone, as reported by the
system clock.
</p>
<p>
<dl class="return" compact><dt><b>Returns:</b></dt><dd> current date
</dd></dl> <dl class="see" compact><dt><b>See also:</b></dt><dd> currentLocalDateTime(), currentLocalTime()
</dd></dl> <dl class="since" compact><dt><b>Since:</b></dt><dd> 4.3
</dd></dl>
</p></div></div><a class="anchor" name="currentLocalDateTime"></a>
<div class="memitem">
<div class="memproto">
<table class="memname"><tr>
<td class="memname"><a href="../kdecore/KDateTime.html">KDateTime</a> currentLocalDateTime</td>
<td>(</td>
<td class="paramtype"> </td>
<td class="paramname">)</td>
<td width="100%"> </td>
</tr>
</table>
</div>
<div class="memdoc"><p>Returns the current date and time, as reported by the system clock,
expressed in the local system time zone.
</p>
<p>
<dl class="return" compact><dt><b>Returns:</b></dt><dd> current date/time
</dd></dl> <dl class="see" compact><dt><b>See also:</b></dt><dd> currentUtcDateTime(), currentDateTime()
</dd></dl>
</p></div></div><a class="anchor" name="currentLocalTime"></a>
<div class="memitem">
<div class="memproto">
<table class="memname"><tr>
<td class="memname">QTime currentLocalTime</td>
<td>(</td>
<td class="paramtype"> </td>
<td class="paramname">)</td>
<td width="100%"> </td>
</tr>
</table>
</div>
<div class="memdoc"><p>Returns the current time of day in the local time zone, as reported
by the system clock.
</p>
<p>
<dl class="return" compact><dt><b>Returns:</b></dt><dd> current date
</dd></dl> <dl class="see" compact><dt><b>See also:</b></dt><dd> currentLocalDateTime(), currentLocalDate()
</dd></dl> <dl class="since" compact><dt><b>Since:</b></dt><dd> 4.3
</dd></dl>
</p></div></div><a class="anchor" name="currentUtcDateTime"></a>
<div class="memitem">
<div class="memproto">
<table class="memname"><tr>
<td class="memname"><a href="../kdecore/KDateTime.html">KDateTime</a> currentUtcDateTime</td>
<td>(</td>
<td class="paramtype"> </td>
<td class="paramname">)</td>
<td width="100%"> </td>
</tr>
</table>
</div>
<div class="memdoc"><p>Returns the current date and time, as reported by the system clock,
expressed in UTC.
</p>
<p>
<dl class="return" compact><dt><b>Returns:</b></dt><dd> current date/time
</dd></dl> <dl class="see" compact><dt><b>See also:</b></dt><dd> currentLocalDateTime(), currentDateTime(), currentLocalDate(), currentLocalTime()
</dd></dl>
</p></div></div><a class="anchor" name="fromString"></a>
<div class="memitem">
<div class="memproto">
<table class="memname"><tr>
<td class="memname"><a href="../kdecore/KDateTime.html">KDateTime</a>, bool negZero fromString</td>
<td>(</td>
<td class="paramtype">QString </td>
<td class="paramname"><em>string</em>, </td>
</tr>
<tr>
<td class="memname"></td>
<td></td>
<td class="paramtype"><a href="../kdecore/KDateTime.html#TimeFormat">KDateTime.TimeFormat</a> </td>
<td class="paramname"><em>format=KDateTime.ISODate</em></td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td>
<td></td>
<td width="100%"> </td>
</tr></table>
</div>
<div class="memdoc"><p>Returns the KDateTime represented by <b>string,</b> using the <b>format</b>
given, optionally using a time zone collection <b>zones</b> as the source of
time zone definitions. The <b>format</b> codes are basically the same as
those for toString(), and are similar but not identical to those used by
strftime(3).
</p>
<p>
The <b>format</b> string consists of the same codes as that for
toString(). However, some codes which are distinct in toString() have
the same function as each other here.
</p>
<p>
Numeric values without a stated number of digits permit, but do not
require, leading zeroes. The maximum number of digits consumed by a
numeric code is the minimum needed to cover the possible range of the
number (e.g. for minutes, the range is 0 - 59, so the maximum number of
digits consumed is 2). All non-numeric values are case insensitive.
</p>
<p>
<b>Date</b>
</p>
<p>
- \%y year excluding century (0 - 99). Years 0 - 50 return 2000 - 2050,
while years 51 - 99 return 1951 - 1999.
- \%Y full year number (4 digits with optional sign)
- %:Y full year number (>= 4 digits with optional sign)
- %:m month number (1 - 12)
- \%m month number, 2 digits (01 - 12)
- \%b
- \%B month name in the current locale or, if no match, in English,
abbreviated or in full
- %:b
- %:B month name in English, abbreviated or in full
- \%e day of the month (1 - 31)
- \%d day of the month, 2 digits (01 - 31)
- \%a
- \%A weekday name in the current locale or, if no match, in English,
abbreviated or in full
- %:a
- %:A weekday name in English, abbreviated or in full
</p>
<p>
<b>Time</b>
</p>
<p>
- \%H hour in the 24 hour clock, 2 digits (00 - 23)
- \%k hour in the 24 hour clock (0 - 23)
- \%I hour in the 12 hour clock, 2 digits (01 - 12)
- \%l hour in the 12 hour clock (1 - 12)
- \%M minute, 2 digits (00 - 59)
- %:M minute (0 - 59)
- \%S seconds, 2 digits (00 - 59)
- \%s seconds (0 - 59)
- %:S optional seconds value (0 - 59) preceded with ':'. If no colon is
found in <b>string,</b> no input is consumed and the seconds value is
set to zero.
- %:s fractional seconds value, preceded with a decimal point (either '.'
or the locale's decimal point symbol)
- \%P
- \%p "am" or "pm", in the current locale or, if no match, in
English. This format is only useful when used with \%I or \%l.
- %:P
- %:p "am" or "pm" in English. This format is only useful when used with
\%I or \%l.
</p>
<p>
<b>Time</b> zone
</p>
<p>
- %:u
- \%z UTC offset of the time zone in hours and optionally minutes,
e.g. -02, -0200.
- %:z UTC offset of the time zone in hours and minutes, colon separated,
e.g. +02:00.
- \%Z time zone abbreviation, consisting of alphanumeric characters,
e.g. UTC, EDT, GMT.
- %:Z time zone name, e.g. Europe/London. The name may contain any
characters and is delimited by the following character in the
<b>format</b> string. It will not work if you follow %:Z with another
escape sequence (except %% or \%t).
</p>
<p>
<b>Other</b>
</p>
<p>
- \%t matches one or more whitespace characters
- %% literal '\%' character
</p>
<p>
Any other character must have a matching character in <b>string,</b> except
that a space will match zero or more whitespace characters in the input
string.
</p>
<p>
If any time zone information is present in the string, the function
attempts to find a matching time zone in the <b>zones</b> collection. A time
zone name (format code %:Z) will provide an unambiguous look up in
<b>zones.</b> Any other type of time zone information (an abbreviated time
zone code (\%Z) or UTC offset (\%z, %:z, %:u) is searched for in <b>zones</b>
and if only one time zone is found to match, the result is set to that
zone. Otherwise:
- If more than one match of a UTC offset is found, the action taken is
determined by <b>offsetIfAmbiguous:</b> if <b>offsetIfAmbiguous</b> is true,
a local time with an offset from UTC (type OffsetFromUTC) will be
returned; if false an invalid KDateTime is returned.
- If more than one match of a time zone abbreviation is found, the UTC
offset for each matching time zone is compared and, if the offsets are
the same, a local time with an offset from UTC (type OffsetFromUTC)
will be returned provided that <b>offsetIfAmbiguous</b> is true. Otherwise
an invalid KDateTime is returned.
- If a time zone abbreviation does not match any time zone in <b>zones,</b>
or the abbreviation does not apply at the parsed date/time, an
invalid KDateTime is returned.
- If a time zone name does not match any time zone in <b>zones,</b> an
invalid KDateTime is returned.
- If the time zone UTC offset does not match any time zone in <b>zones,</b>
a local time with an offset from UTC (type OffsetFromUTC) is
returned.
If <b>format</b> contains more than one time zone or UTC offset code, an
error is returned.
</p>
<p>
If no time zone information is present in the string, by default a local
clock time (type ClockTime) is returned. You can use
setFromStringDefault() to change this default.
</p>
<p>
If no time is found in <b>string,</b> a date-only value is returned.
</p>
<p>
If any inconsistencies are found, i.e. the same item of information
appears more than once but with different values, the weekday name does
not tally with the date, an invalid KDateTime is returned.
</p>
<p>
If an invalid KDateTime is returned, you can check why <b>format</b> was
considered invalid by use of outOfRange(). If that method returns true,
it indicates that <b>format</b> was in fact valid, but the date lies outside
the range which can be represented by QDate.
</p>
<p>
</p><dl compact><dt><b>Parameters:</b></dt><dd>
<table border="0" cellspacing="2" cellpadding="0">
<tr><td></td><td valign="top"><em>string</em> </td><td> string to convert
<tr><td></td><td valign="top"><em>format</em> </td><td> format string
<tr><td></td><td valign="top"><em>zones</em> </td><td> time zone collection, or null for none
<tr><td></td><td valign="top"><em>offsetIfAmbiguous</em> </td><td> specifies what to do if more than one zone
matches the UTC offset found in the
string. Ignored if <b>zones</b> is null.
</td></tr> </table></dl>
<p> <dl class="return" compact><dt><b>Returns:</b></dt><dd> KDateTime value, or an invalid KDateTime if an error occurs, if
time zone information doesn't match any in <b>zones,</b> or if the
time zone information is ambiguous and <b>offsetIfAmbiguous</b> is
false
</dd></dl> <dl class="see" compact><dt><b>See also:</b></dt><dd> setFromStringDefault(), toString(), outOfRange()
</dd></dl>
</p></div></div><a class="anchor" name="fromString"></a>
<div class="memitem">
<div class="memproto">
<table class="memname"><tr>
<td class="memname"><a href="../kdecore/KDateTime.html">KDateTime</a> fromString</td>
<td>(</td>
<td class="paramtype">QString </td>
<td class="paramname"><em>string</em>, </td>
</tr>
<tr>
<td class="memname"></td>
<td></td>
<td class="paramtype">QString </td>
<td class="paramname"><em>format</em>, </td>
</tr>
<tr>
<td class="memname"></td>
<td></td>
<td class="paramtype"><a href="../kdecore/KTimeZones.html">KTimeZones</a> </td>
<td class="paramname"><em>zones=0</em>, </td>
</tr>
<tr>
<td class="memname"></td>
<td></td>
<td class="paramtype">bool </td>
<td class="paramname"><em>offsetIfAmbiguous=1</em></td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td>
<td></td>
<td width="100%"> </td>
</tr></table>
</div>
<div class="memdoc"><p>Returns the KDateTime represented by <b>string,</b> using the <b>format</b>
given, optionally using a time zone collection <b>zones</b> as the source of
time zone definitions. The <b>format</b> codes are basically the same as
those for toString(), and are similar but not identical to those used by
strftime(3).
</p>
<p>
The <b>format</b> string consists of the same codes as that for
toString(). However, some codes which are distinct in toString() have
the same function as each other here.
</p>
<p>
Numeric values without a stated number of digits permit, but do not
require, leading zeroes. The maximum number of digits consumed by a
numeric code is the minimum needed to cover the possible range of the
number (e.g. for minutes, the range is 0 - 59, so the maximum number of
digits consumed is 2). All non-numeric values are case insensitive.
</p>
<p>
<b>Date</b>
</p>
<p>
- \%y year excluding century (0 - 99). Years 0 - 50 return 2000 - 2050,
while years 51 - 99 return 1951 - 1999.
- \%Y full year number (4 digits with optional sign)
- %:Y full year number (>= 4 digits with optional sign)
- %:m month number (1 - 12)
- \%m month number, 2 digits (01 - 12)
- \%b
- \%B month name in the current locale or, if no match, in English,
abbreviated or in full
- %:b
- %:B month name in English, abbreviated or in full
- \%e day of the month (1 - 31)
- \%d day of the month, 2 digits (01 - 31)
- \%a
- \%A weekday name in the current locale or, if no match, in English,
abbreviated or in full
- %:a
- %:A weekday name in English, abbreviated or in full
</p>
<p>
<b>Time</b>
</p>
<p>
- \%H hour in the 24 hour clock, 2 digits (00 - 23)
- \%k hour in the 24 hour clock (0 - 23)
- \%I hour in the 12 hour clock, 2 digits (01 - 12)
- \%l hour in the 12 hour clock (1 - 12)
- \%M minute, 2 digits (00 - 59)
- %:M minute (0 - 59)
- \%S seconds, 2 digits (00 - 59)
- \%s seconds (0 - 59)
- %:S optional seconds value (0 - 59) preceded with ':'. If no colon is
found in <b>string,</b> no input is consumed and the seconds value is
set to zero.
- %:s fractional seconds value, preceded with a decimal point (either '.'
or the locale's decimal point symbol)
- \%P
- \%p "am" or "pm", in the current locale or, if no match, in
English. This format is only useful when used with \%I or \%l.
- %:P
- %:p "am" or "pm" in English. This format is only useful when used with
\%I or \%l.
</p>
<p>
<b>Time</b> zone
</p>
<p>
- %:u
- \%z UTC offset of the time zone in hours and optionally minutes,
e.g. -02, -0200.
- %:z UTC offset of the time zone in hours and minutes, colon separated,
e.g. +02:00.
- \%Z time zone abbreviation, consisting of alphanumeric characters,
e.g. UTC, EDT, GMT.
- %:Z time zone name, e.g. Europe/London. The name may contain any
characters and is delimited by the following character in the
<b>format</b> string. It will not work if you follow %:Z with another
escape sequence (except %% or \%t).
</p>
<p>
<b>Other</b>
</p>
<p>
- \%t matches one or more whitespace characters
- %% literal '\%' character
</p>
<p>
Any other character must have a matching character in <b>string,</b> except
that a space will match zero or more whitespace characters in the input
string.
</p>
<p>
If any time zone information is present in the string, the function
attempts to find a matching time zone in the <b>zones</b> collection. A time
zone name (format code %:Z) will provide an unambiguous look up in
<b>zones.</b> Any other type of time zone information (an abbreviated time
zone code (\%Z) or UTC offset (\%z, %:z, %:u) is searched for in <b>zones</b>
and if only one time zone is found to match, the result is set to that
zone. Otherwise:
- If more than one match of a UTC offset is found, the action taken is
determined by <b>offsetIfAmbiguous:</b> if <b>offsetIfAmbiguous</b> is true,
a local time with an offset from UTC (type OffsetFromUTC) will be
returned; if false an invalid KDateTime is returned.
- If more than one match of a time zone abbreviation is found, the UTC
offset for each matching time zone is compared and, if the offsets are
the same, a local time with an offset from UTC (type OffsetFromUTC)
will be returned provided that <b>offsetIfAmbiguous</b> is true. Otherwise
an invalid KDateTime is returned.
- If a time zone abbreviation does not match any time zone in <b>zones,</b>
or the abbreviation does not apply at the parsed date/time, an
invalid KDateTime is returned.
- If a time zone name does not match any time zone in <b>zones,</b> an
invalid KDateTime is returned.
- If the time zone UTC offset does not match any time zone in <b>zones,</b>
a local time with an offset from UTC (type OffsetFromUTC) is
returned.
If <b>format</b> contains more than one time zone or UTC offset code, an
error is returned.
</p>
<p>
If no time zone information is present in the string, by default a local
clock time (type ClockTime) is returned. You can use
setFromStringDefault() to change this default.
</p>
<p>
If no time is found in <b>string,</b> a date-only value is returned.
</p>
<p>
If any inconsistencies are found, i.e. the same item of information
appears more than once but with different values, the weekday name does
not tally with the date, an invalid KDateTime is returned.
</p>
<p>
If an invalid KDateTime is returned, you can check why <b>format</b> was
considered invalid by use of outOfRange(). If that method returns true,
it indicates that <b>format</b> was in fact valid, but the date lies outside
the range which can be represented by QDate.
</p>
<p>
</p><dl compact><dt><b>Parameters:</b></dt><dd>
<table border="0" cellspacing="2" cellpadding="0">
<tr><td></td><td valign="top"><em>string</em> </td><td> string to convert
<tr><td></td><td valign="top"><em>format</em> </td><td> format string
<tr><td></td><td valign="top"><em>zones</em> </td><td> time zone collection, or null for none
<tr><td></td><td valign="top"><em>offsetIfAmbiguous</em> </td><td> specifies what to do if more than one zone
matches the UTC offset found in the
string. Ignored if <b>zones</b> is null.
</td></tr> </table></dl>
<p> <dl class="return" compact><dt><b>Returns:</b></dt><dd> KDateTime value, or an invalid KDateTime if an error occurs, if
time zone information doesn't match any in <b>zones,</b> or if the
time zone information is ambiguous and <b>offsetIfAmbiguous</b> is
false
</dd></dl> <dl class="see" compact><dt><b>See also:</b></dt><dd> setFromStringDefault(), toString(), outOfRange()
</dd></dl>
</p></div></div><a class="anchor" name="realCurrentLocalDateTime"></a>
<div class="memitem">
<div class="memproto">
<table class="memname"><tr>
<td class="memname"><a href="../kdecore/KDateTime.html">KDateTime</a> realCurrentLocalDateTime</td>
<td>(</td>
<td class="paramtype"> </td>
<td class="paramname">)</td>
<td width="100%"> </td>
</tr>
</table>
</div>
<div class="memdoc"><p>Return the real (not simulated) system time.
</p>
<p>
<dl class="warning" compact><dt><b>Warning:</b></dt><dd> This method is provided only for testing purposes, and should
not be used in released code. If the library is compiled without
debug enabled, currentLocalDateTime() and realCurrentLocalDateTime()
both return the real system time.
To avoid confusion, it is recommended that calls to
realCurrentLocalDateTime() should be conditionally compiled, e.g.:
</dd></dl> <pre class="fragment">
#ifndef NDEBUG
dt = KDateTime.realCurrentLocalDateTime();
#endif
</pre>
</p>
<p>
<dl class="since" compact><dt><b>Since:</b></dt><dd> 4.3
</dd></dl>
</p></div></div><a class="anchor" name="setFromStringDefault"></a>
<div class="memitem">
<div class="memproto">
<table class="memname"><tr>
<td class="memname"> setFromStringDefault</td>
<td>(</td>
<td class="paramtype"><a href="../kdecore/KDateTime.Spec.html">KDateTime.Spec</a> </td>
<td class="paramname"><em>spec</em></td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td>
<td></td>
<td width="100%"> </td>
</tr></table>
</div>
<div class="memdoc"><p>Sets the default time specification for use by fromString() when no time
zone or UTC offset is found in the string being parsed, or when "-0000"
is found in an RFC 2822 string.
</p>
<p>
By default, fromString() returns a local clock time (type ClockTime)
when no definite zone or UTC offset is found. You can use this method
to make it return the local time zone, UTC, or whatever you wish.
</p>
<p>
</p><dl compact><dt><b>Parameters:</b></dt><dd>
<table border="0" cellspacing="2" cellpadding="0">
<tr><td></td><td valign="top"><em>spec</em> </td><td> the new default time specification
</td></tr> </table></dl>
<p> <dl class="see" compact><dt><b>See also:</b></dt><dd> fromString()
</dd></dl>
</p></div></div><a class="anchor" name="setSimulatedSystemTime"></a>
<div class="memitem">
<div class="memproto">
<table class="memname"><tr>
<td class="memname"> setSimulatedSystemTime</td>
<td>(</td>
<td class="paramtype"><a href="../kdecore/KDateTime.html">KDateTime</a> </td>
<td class="paramname"><em>newTime</em></td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td>
<td></td>
<td width="100%"> </td>
</tr></table>
</div>
<div class="memdoc"><p>Set an adjustment to be applied when fetching the current system time.
This is applied by all KDateTime methods which return the system date
and/or time.
</p>
<p>
The supplied date/time is used as the current simulated time and the
time adjustment is set to the difference between the real current time
and <b>newTime.</b> If <b>newTime</b> has a time zone, that time zone is set
to be the simulated local system time zone by calling
KSystemTimeZones.setLocalZone()).
</p>
<p>
To cancel time simulation, supply an invalid <b>newTime</b> parameter.
</p>
<p>
<dl class="warning" compact><dt><b>Warning:</b></dt><dd> This function is provided only for testing purposes, and should
not be used in released code. If the library is compiled without
debug enabled, setSimulatedSystemTime() has no effect.
To avoid confusion, it is recommended that calls to it should be
conditionally compiled, e.g.:
</dd></dl> <pre class="fragment">
#ifndef NDEBUG
KDateTime.simulateSystemTime(kdt);
#endif
</pre>
</p>
<p>
</p><dl compact><dt><b>Parameters:</b></dt><dd>
<table border="0" cellspacing="2" cellpadding="0">
<tr><td></td><td valign="top"><em>newTime</em> </td><td> the current simulated time, or invalid to cancel simulation
</td></tr>
</table></dl>
<p> <dl class="see" compact><dt><b>See also:</b></dt><dd> currentDateTime(), currentLocalDateTime(), currentUtcDateTime(),
currentLocalDate(), currentLocalTime()
</dd></dl> <dl class="since" compact><dt><b>Since:</b></dt><dd> 4.3
</dd></dl>
</p></div></div><hr><h2>Enumeration Documentation</h2><a class="anchor" name="Comparison"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr><td class="memname">Comparison</td>
</tr>
</table>
</div>
<div class="memdoc"><p>How this KDateTime compares with another.
If any date-only value is involved, comparison of KDateTime values
requires them to be considered as representing time periods. A date-only
instance represents a time period from 00:00:00 to 23:59:59.999 on a given
date, while a date/time instance can be considered to represent a time
period whose start and end times are the same. They may therefore be
earlier or later, or may overlap or be contained one within the other.
</p>
<p>
Values may be OR'ed with each other in any combination of 'consecutive'
intervals to represent different types of relationship.
</p>
<p>
In the descriptions of the values below,
- s1 = start time of this instance
- e1 = end time of this instance
- s2 = start time of other instance
- e2 = end time of other instance.
</p><dl compact><dt><b>Enumerator: </b></dt><dd>
<table border="0" cellspacing="2" cellpadding="0"><tr><td valign="top"><em>Before</em> = 0x01</td><td><tr><td valign="top"><em>AtStart</em> = 0x02</td><td><tr><td valign="top"><em>Inside</em> = 0x04</td><td><tr><td valign="top"><em>AtEnd</em> = 0x08</td><td><tr><td valign="top"><em>After</em> = 0x10</td><td><tr><td valign="top"><em>Equal</em> = AtStart|Inside|AtEnd</td><td><tr><td valign="top"><em>Outside</em> = Before|AtStart|Inside|AtEnd|After</td><td><tr><td valign="top"><em>StartsAt</em> = AtStart|Inside|AtEnd|After</td><td><tr><td valign="top"><em>EndsAt</em> = Before|AtStart|Inside|AtEnd</td><td></table>
</dl>
</div></div><p><a class="anchor" name="SpecType"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr><td class="memname">SpecType</td>
</tr>
</table>
</div>
<div class="memdoc"><p>The time specification type of a KDateTime instance.
This specifies how the date/time component of the KDateTime instance
should be interpreted, i.e. what type of time zone (if any) the date/time
is expressed in. For the full time specification (including time zone
details), see KDateTime.Spec.
</p><dl compact><dt><b>Enumerator: </b></dt><dd>
<table border="0" cellspacing="2" cellpadding="0"><tr><td valign="top"><em>Invalid</em> </td><td><tr><td valign="top"><em>UTC</em> </td><td><tr><td valign="top"><em>OffsetFromUTC</em> </td><td><tr><td valign="top"><em>TimeZone</em> </td><td><tr><td valign="top"><em>LocalZone</em> </td><td><tr><td valign="top"><em>ClockTime</em> </td><td></table>
</dl>
</div></div><p><a class="anchor" name="TimeFormat"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr><td class="memname">TimeFormat</td>
</tr>
</table>
</div>
<div class="memdoc"><p>Format for strings representing date/time values.
</p><dl compact><dt><b>Enumerator: </b></dt><dd>
<table border="0" cellspacing="2" cellpadding="0"><tr><td valign="top"><em>ISODate</em> </td><td><tr><td valign="top"><em>RFCDate</em> </td><td><tr><td valign="top"><em>RFCDateDay</em> </td><td><tr><td valign="top"><em>QtTextDate</em> </td><td><tr><td valign="top"><em>LocalDate</em> </td><td><tr><td valign="top"><em>RFC3339Date</em> </td><td></table>
</dl>
</div></div><p>
</div>
</div>
</div>
<div id="left">
<div class="menu_box">
<div class="nav_list">
<ul>
<li><a href="../allclasses.html">Full Index</a></li>
</ul>
</div>
<a name="cp-menu" /><div class="menutitle"><div>
<h2 id="cp-menu-project">Modules</h2>
</div></div>
<div class="nav_list">
<ul><li><a href="../akonadi/index.html">akonadi</a></li>
<li><a href="../dnssd/index.html">dnssd</a></li>
<li><a href="../kdecore/index.html">kdecore</a></li>
<li><a href="../kdeui/index.html">kdeui</a></li>
<li><a href="../khtml/index.html">khtml</a></li>
<li><a href="../kio/index.html">kio</a></li>
<li><a href="../knewstuff/index.html">knewstuff</a></li>
<li><a href="../kparts/index.html">kparts</a></li>
<li><a href="../kutils/index.html">kutils</a></li>
<li><a href="../nepomuk/index.html">nepomuk</a></li>
<li><a href="../phonon/index.html">phonon</a></li>
<li><a href="../plasma/index.html">plasma</a></li>
<li><a href="../polkitqt/index.html">polkitqt</a></li>
<li><a href="../solid/index.html">solid</a></li>
<li><a href="../soprano/index.html">soprano</a></li>
</ul></div></div>
</div>
</div>
<div class="clearer"/>
</div>
<div id="end_body"></div>
</div>
<div id="footer"><div id="footer_text">
This documentation is maintained by <a href="mailto:simon@simonzone.com">Simon Edwards</a>.<br />
KDE<sup>®</sup> and <a href="../images/kde_gear_black.png">the K Desktop Environment<sup>®</sup> logo</a> are registered trademarks of <a href="http://ev.kde.org/" title="Homepage of the KDE non-profit Organization">KDE e.V.</a> |
<a href="http://www.kde.org/contact/impressum.php">Legal</a>
</div></div>
</body>
</html>
|