Lines Matching refs:DateTime
434 auto dt = DateTime.init; argument
439 const cdt = DateTime(1999, 7, 6); argument
440 immutable idt = DateTime(1999, 7, 6); argument
447 The time portion of $(LREF DateTime).
457 auto dt = DateTime.init; argument
462 auto dt = DateTime(Date.init, TimeOfDay(12, 30, 33)); argument
466 const cdt = DateTime(1999, 7, 6, 12, 30, 33); argument
467 immutable idt = DateTime(1999, 7, 6, 12, 30, 33); argument
474 The time portion of $(LREF DateTime).
478 $(LREF DateTime)'s time portion to.
540 assert(DateTime(Date(1999, 7, 6), TimeOfDay(9, 7, 5)).year == 1999); argument
541 assert(DateTime(Date(2010, 10, 4), TimeOfDay(0, 0, 30)).year == 2010);
542 assert(DateTime(Date(-7, 4, 5), TimeOfDay(7, 45, 2)).year == -7);
547 static void testDT(DateTime dt, int year, in DateTime expected, size_t line = __LINE__)
553 testDT(DateTime(Date(1, 1, 1), TimeOfDay(12, 30, 33)),
555 DateTime(Date(1999, 1, 1), TimeOfDay(12, 30, 33)));
556 testDT(DateTime(Date(1, 1, 1), TimeOfDay(12, 30, 33)),
558 DateTime(Date(0, 1, 1), TimeOfDay(12, 30, 33)));
559 testDT(DateTime(Date(1, 1, 1), TimeOfDay(12, 30, 33)),
561 DateTime(Date(-1999, 1, 1), TimeOfDay(12, 30, 33)));
563 const cdt = DateTime(1999, 7, 6, 12, 30, 33); argument
564 immutable idt = DateTime(1999, 7, 6, 12, 30, 33); argument
584 assert(DateTime(Date(0, 1, 1), TimeOfDay(12, 30, 33)).yearBC == 1); argument
585 assert(DateTime(Date(-1, 1, 1), TimeOfDay(10, 7, 2)).yearBC == 2);
586 assert(DateTime(Date(-100, 1, 1), TimeOfDay(4, 59, 0)).yearBC == 101);
591 assertThrown!DateTimeException((in DateTime dt){dt.yearBC;}(DateTime(Date(1, 1, 1))));
593 auto dt = DateTime(1999, 7, 6, 12, 30, 33); argument
594 const cdt = DateTime(1999, 7, 6, 12, 30, 33); argument
595 immutable idt = DateTime(1999, 7, 6, 12, 30, 33); argument
607 year = The year B.C. to set this $(LREF DateTime)'s year to.
689 …static void testDT(DateTime dt, Month month, in DateTime expected = DateTime.init, size_t line = _… argument
692 assert(expected != DateTime.init);
696 …assertThrown!DateTimeException(testDT(DateTime(Date(1, 1, 1), TimeOfDay(12, 30, 33)), cast(Month) …
697 …assertThrown!DateTimeException(testDT(DateTime(Date(1, 1, 1), TimeOfDay(12, 30, 33)), cast(Month) …
699 testDT(DateTime(Date(1, 1, 1), TimeOfDay(12, 30, 33)),
701 DateTime(Date(1, 7, 1), TimeOfDay(12, 30, 33)));
702 testDT(DateTime(Date(-1, 1, 1), TimeOfDay(12, 30, 33)),
704 DateTime(Date(-1, 7, 1), TimeOfDay(12, 30, 33)));
706 const cdt = DateTime(1999, 7, 6, 12, 30, 33); argument
707 immutable idt = DateTime(1999, 7, 6, 12, 30, 33); argument
724 assert(DateTime(Date(1999, 7, 6), TimeOfDay(9, 7, 5)).day == 6); argument
725 assert(DateTime(Date(2010, 10, 4), TimeOfDay(0, 0, 30)).day == 4);
726 assert(DateTime(Date(-7, 4, 5), TimeOfDay(7, 45, 2)).day == 5);
734 static void test(DateTime dateTime, int expected) in test() argument
744 test(DateTime(Date(year, md.month, md.day), tod), md.day); argument
748 const cdt = DateTime(1999, 7, 6, 12, 30, 33); argument
749 immutable idt = DateTime(1999, 7, 6, 12, 30, 33); argument
759 day = The day of the month to set this $(LREF DateTime)'s day to.
884 result in an invalid $(LREF DateTime). in day()
893 … assertThrown!DateTimeException((){DateTime(Date(1999, 7, 6), TimeOfDay(0, 0, 0)).hour = 24;}()); argument
895 auto dt = DateTime.init; argument
897 assert(dt == DateTime(1, 1, 1, 12, 0, 0));
899 const cdt = DateTime(1999, 7, 6, 12, 30, 33); argument
900 immutable idt = DateTime(1999, 7, 6, 12, 30, 33); argument
916 assert(DateTime.init.minute == 0); argument
917 assert(DateTime(1, 1, 1, 0, 30, 0).minute == 30);
919 const cdt = DateTime(1999, 7, 6, 12, 30, 33); argument
920 immutable idt = DateTime(1999, 7, 6, 12, 30, 33); argument
930 minute = The minute to set this $(LREF DateTime)'s minute to.
984 would result in an invalid $(LREF DateTime). in minute()
993 assertThrown!DateTimeException((){DateTime.init.second = 60;}()); argument
995 auto dt = DateTime.init; argument
997 assert(dt == DateTime(1, 1, 1, 0, 0, 33));
999 const cdt = DateTime(1999, 7, 6, 12, 30, 33); argument
1000 immutable idt = DateTime(1999, 7, 6, 12, 30, 33); argument
1007 Adds the given number of years or months to this $(LREF DateTime). A
1021 $(LREF DateTime).
1025 ref DateTime add(string units)
1036 auto dt1 = DateTime(2010, 1, 1, 12, 30, 33); argument
1038 assert(dt1 == DateTime(2010, 12, 1, 12, 30, 33));
1040 auto dt2 = DateTime(2010, 1, 1, 12, 30, 33); argument
1042 assert(dt2 == DateTime(2009, 2, 1, 12, 30, 33));
1044 auto dt3 = DateTime(2000, 2, 29, 12, 30, 33); argument
1046 assert(dt3 == DateTime(2001, 3, 1, 12, 30, 33));
1048 auto dt4 = DateTime(2000, 2, 29, 12, 30, 33); argument
1050 assert(dt4 == DateTime(2001, 2, 28, 12, 30, 33));
1055 auto dt = DateTime(2000, 1, 31); argument
1057 assert(dt == DateTime(2006, 10, 1));
1059 const cdt = DateTime(1999, 7, 6, 12, 30, 33); argument
1060 immutable idt = DateTime(1999, 7, 6, 12, 30, 33); argument
1069 Adds the given number of years or months to this $(LREF DateTime). A
1073 affect larger units. Rolling a $(LREF DateTime) 12 months
1074 gets the exact same $(LREF DateTime). However, the days can still be
1083 $(LREF DateTime).
1087 ref DateTime roll(string units)
1098 auto dt1 = DateTime(2010, 1, 1, 12, 33, 33); argument
1100 assert(dt1 == DateTime(2010, 2, 1, 12, 33, 33));
1102 auto dt2 = DateTime(2010, 1, 1, 12, 33, 33); argument
1104 assert(dt2 == DateTime(2010, 12, 1, 12, 33, 33));
1106 auto dt3 = DateTime(1999, 1, 29, 12, 33, 33); argument
1108 assert(dt3 == DateTime(1999, 3, 1, 12, 33, 33));
1110 auto dt4 = DateTime(1999, 1, 29, 12, 33, 33); argument
1112 assert(dt4 == DateTime(1999, 2, 28, 12, 33, 33));
1114 auto dt5 = DateTime(2000, 2, 29, 12, 30, 33); argument
1116 assert(dt5 == DateTime(2001, 3, 1, 12, 30, 33));
1118 auto dt6 = DateTime(2000, 2, 29, 12, 30, 33); argument
1120 assert(dt6 == DateTime(2001, 2, 28, 12, 30, 33));
1125 auto dt = DateTime(2000, 1, 31); argument
1127 assert(dt == DateTime(2007, 10, 1));
1129 const cdt = DateTime(1999, 7, 6, 12, 30, 33); argument
1130 immutable idt = DateTime(1999, 7, 6, 12, 30, 33); argument
1139 Adds the given number of units to this $(LREF DateTime). A negative
1143 affect larger units. For instance, rolling a $(LREF DateTime) one
2363 rhs = The $(LREF DateTime) to subtract from this one.
2365 int diffMonths(in DateTime rhs) const @safe pure nothrow @nogc in diffMonths() argument
2373 assert(DateTime(1999, 2, 1, 12, 2, 3).diffMonths(
2374 DateTime(1999, 1, 31, 23, 59, 59)) == 1);
2376 assert(DateTime(1999, 1, 31, 0, 0, 0).diffMonths(
2377 DateTime(1999, 2, 1, 12, 3, 42)) == -1);
2379 assert(DateTime(1999, 3, 1, 5, 30, 0).diffMonths(
2380 DateTime(1999, 1, 1, 2, 4, 7)) == 2);
2382 assert(DateTime(1999, 1, 1, 7, 2, 4).diffMonths(
2383 DateTime(1999, 3, 31, 0, 30, 58)) == -2);
2388 auto dt = DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)); argument
2389 const cdt = DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)); argument
2390 immutable idt = DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)); argument
2406 Whether this $(LREF DateTime) is in a leap year.
2415 auto dt = DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)); argument
2416 const cdt = DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)); argument
2417 immutable idt = DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)); argument
2425 Day of the week this $(LREF DateTime) is on.
2434 auto dt = DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)); argument
2435 const cdt = DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)); argument
2436 immutable idt = DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)); argument
2444 Day of the year this $(LREF DateTime) is on.
2454 assert(DateTime(Date(1999, 1, 1), TimeOfDay(12, 22, 7)).dayOfYear == 1); argument
2455 assert(DateTime(Date(1999, 12, 31), TimeOfDay(7, 2, 59)).dayOfYear == 365);
2456 assert(DateTime(Date(2000, 12, 31), TimeOfDay(21, 20, 0)).dayOfYear == 366);
2461 auto dt = DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)); argument
2462 const cdt = DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)); argument
2463 immutable idt = DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)); argument
2475 $(LREF DateTime) is on.
2484 auto dt = DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)); argument
2485 const cdt = DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)); argument
2486 immutable idt = DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)); argument
2495 The Xth day of the Gregorian Calendar that this $(LREF DateTime) is on.
2505 assert(DateTime(Date(1, 1, 1), TimeOfDay(0, 0, 0)).dayOfGregorianCal == 1); argument
2506 assert(DateTime(Date(1, 12, 31), TimeOfDay(23, 59, 59)).dayOfGregorianCal == 365);
2507 assert(DateTime(Date(2, 1, 1), TimeOfDay(2, 2, 2)).dayOfGregorianCal == 366);
2509 assert(DateTime(Date(0, 12, 31), TimeOfDay(7, 7, 7)).dayOfGregorianCal == 0);
2510 assert(DateTime(Date(0, 1, 1), TimeOfDay(19, 30, 0)).dayOfGregorianCal == -365);
2511 assert(DateTime(Date(-1, 12, 31), TimeOfDay(4, 7, 0)).dayOfGregorianCal == -366);
2513 assert(DateTime(Date(2000, 1, 1), TimeOfDay(9, 30, 20)).dayOfGregorianCal == 730_120);
2514 assert(DateTime(Date(2010, 12, 31), TimeOfDay(15, 45, 50)).dayOfGregorianCal == 734_137);
2519 const cdt = DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)); argument
2520 immutable idt = DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)); argument
2527 The Xth day of the Gregorian Calendar that this $(LREF DateTime) is on.
2529 $(LREF DateTime).
2532 days = The day of the Gregorian Calendar to set this $(LREF DateTime)
2543 auto dt = DateTime(Date.init, TimeOfDay(12, 0, 0)); argument
2545 assert(dt == DateTime(Date(1, 1, 1), TimeOfDay(12, 0, 0)));
2548 assert(dt == DateTime(Date(1, 12, 31), TimeOfDay(12, 0, 0)));
2551 assert(dt == DateTime(Date(2, 1, 1), TimeOfDay(12, 0, 0)));
2554 assert(dt == DateTime(Date(0, 12, 31), TimeOfDay(12, 0, 0)));
2557 assert(dt == DateTime(Date(-0, 1, 1), TimeOfDay(12, 0, 0)));
2560 assert(dt == DateTime(Date(-1, 12, 31), TimeOfDay(12, 0, 0)));
2563 assert(dt == DateTime(Date(2000, 1, 1), TimeOfDay(12, 0, 0)));
2566 assert(dt == DateTime(Date(2010, 12, 31), TimeOfDay(12, 0, 0)));
2571 const cdt = DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)); argument
2572 immutable idt = DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)); argument
2579 The ISO 8601 week of the year that this $(LREF DateTime) is in.
2591 auto dt = DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)); argument
2592 const cdt = DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)); argument
2593 immutable idt = DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)); argument
2601 $(LREF DateTime) for the last day in the month that this
2602 $(LREF DateTime) is in. The time portion of endOfMonth is always
2605 @property DateTime endOfMonth() const @safe pure nothrow in endOfMonth() argument
2608 return DateTime(_date.endOfMonth, TimeOfDay(23, 59, 59)); in endOfMonth()
2616 assert(DateTime(Date(1999, 1, 6), TimeOfDay(0, 0, 0)).endOfMonth ==
2617 DateTime(Date(1999, 1, 31), TimeOfDay(23, 59, 59)));
2619 assert(DateTime(Date(1999, 2, 7), TimeOfDay(19, 30, 0)).endOfMonth ==
2620 DateTime(Date(1999, 2, 28), TimeOfDay(23, 59, 59)));
2622 assert(DateTime(Date(2000, 2, 7), TimeOfDay(5, 12, 27)).endOfMonth ==
2623 DateTime(Date(2000, 2, 29), TimeOfDay(23, 59, 59)));
2625 assert(DateTime(Date(2000, 6, 4), TimeOfDay(12, 22, 9)).endOfMonth ==
2626 DateTime(Date(2000, 6, 30), TimeOfDay(23, 59, 59)));
2632 assert(DateTime(1999, 1, 1, 0, 13, 26).endOfMonth == DateTime(1999, 1, 31, 23, 59, 59));
2633 assert(DateTime(1999, 2, 1, 1, 14, 27).endOfMonth == DateTime(1999, 2, 28, 23, 59, 59));
2634 assert(DateTime(2000, 2, 1, 2, 15, 28).endOfMonth == DateTime(2000, 2, 29, 23, 59, 59));
2635 assert(DateTime(1999, 3, 1, 3, 16, 29).endOfMonth == DateTime(1999, 3, 31, 23, 59, 59));
2636 assert(DateTime(1999, 4, 1, 4, 17, 30).endOfMonth == DateTime(1999, 4, 30, 23, 59, 59));
2637 assert(DateTime(1999, 5, 1, 5, 18, 31).endOfMonth == DateTime(1999, 5, 31, 23, 59, 59));
2638 assert(DateTime(1999, 6, 1, 6, 19, 32).endOfMonth == DateTime(1999, 6, 30, 23, 59, 59));
2639 assert(DateTime(1999, 7, 1, 7, 20, 33).endOfMonth == DateTime(1999, 7, 31, 23, 59, 59));
2640 assert(DateTime(1999, 8, 1, 8, 21, 34).endOfMonth == DateTime(1999, 8, 31, 23, 59, 59));
2641 assert(DateTime(1999, 9, 1, 9, 22, 35).endOfMonth == DateTime(1999, 9, 30, 23, 59, 59));
2642 assert(DateTime(1999, 10, 1, 10, 23, 36).endOfMonth == DateTime(1999, 10, 31, 23, 59, 59));
2643 assert(DateTime(1999, 11, 1, 11, 24, 37).endOfMonth == DateTime(1999, 11, 30, 23, 59, 59));
2644 assert(DateTime(1999, 12, 1, 12, 25, 38).endOfMonth == DateTime(1999, 12, 31, 23, 59, 59));
2647 assert(DateTime(-1999, 1, 1, 0, 13, 26).endOfMonth == DateTime(-1999, 1, 31, 23, 59, 59));
2648 assert(DateTime(-1999, 2, 1, 1, 14, 27).endOfMonth == DateTime(-1999, 2, 28, 23, 59, 59));
2649 assert(DateTime(-2000, 2, 1, 2, 15, 28).endOfMonth == DateTime(-2000, 2, 29, 23, 59, 59));
2650 assert(DateTime(-1999, 3, 1, 3, 16, 29).endOfMonth == DateTime(-1999, 3, 31, 23, 59, 59));
2651 assert(DateTime(-1999, 4, 1, 4, 17, 30).endOfMonth == DateTime(-1999, 4, 30, 23, 59, 59));
2652 assert(DateTime(-1999, 5, 1, 5, 18, 31).endOfMonth == DateTime(-1999, 5, 31, 23, 59, 59));
2653 assert(DateTime(-1999, 6, 1, 6, 19, 32).endOfMonth == DateTime(-1999, 6, 30, 23, 59, 59));
2654 assert(DateTime(-1999, 7, 1, 7, 20, 33).endOfMonth == DateTime(-1999, 7, 31, 23, 59, 59));
2655 assert(DateTime(-1999, 8, 1, 8, 21, 34).endOfMonth == DateTime(-1999, 8, 31, 23, 59, 59));
2656 assert(DateTime(-1999, 9, 1, 9, 22, 35).endOfMonth == DateTime(-1999, 9, 30, 23, 59, 59));
2657 … assert(DateTime(-1999, 10, 1, 10, 23, 36).endOfMonth == DateTime(-1999, 10, 31, 23, 59, 59));
2658 … assert(DateTime(-1999, 11, 1, 11, 24, 37).endOfMonth == DateTime(-1999, 11, 30, 23, 59, 59));
2659 … assert(DateTime(-1999, 12, 1, 12, 25, 38).endOfMonth == DateTime(-1999, 12, 31, 23, 59, 59));
2661 const cdt = DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)); argument
2662 immutable idt = DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)); argument
2663 assert(cdt.endOfMonth == DateTime(1999, 7, 31, 23, 59, 59));
2664 assert(idt.endOfMonth == DateTime(1999, 7, 31, 23, 59, 59));
2669 The last day in the month that this $(LREF DateTime) is in.
2679 assert(DateTime(Date(1999, 1, 6), TimeOfDay(0, 0, 0)).daysInMonth == 31); argument
2680 assert(DateTime(Date(1999, 2, 7), TimeOfDay(19, 30, 0)).daysInMonth == 28);
2681 assert(DateTime(Date(2000, 2, 7), TimeOfDay(5, 12, 27)).daysInMonth == 29);
2682 assert(DateTime(Date(2000, 6, 4), TimeOfDay(12, 22, 9)).daysInMonth == 30);
2687 const cdt = DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)); argument
2688 immutable idt = DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)); argument
2705 assert(DateTime(Date(1, 1, 1), TimeOfDay(12, 7, 0)).isAD); argument
2706 assert(DateTime(Date(2010, 12, 31), TimeOfDay(0, 0, 0)).isAD);
2707 assert(!DateTime(Date(0, 12, 31), TimeOfDay(23, 59, 59)).isAD);
2708 assert(!DateTime(Date(-2010, 1, 1), TimeOfDay(2, 2, 2)).isAD);
2713 const cdt = DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)); argument
2714 immutable idt = DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)); argument
2722 $(LREF DateTime) at the given time. For example, prior to noon,
2737 assert(DateTime(Date(-4713, 11, 24), TimeOfDay(0, 0, 0)).julianDay == -1); argument
2738 assert(DateTime(Date(-4713, 11, 24), TimeOfDay(12, 0, 0)).julianDay == 0);
2740 assert(DateTime(Date(0, 12, 31), TimeOfDay(0, 0, 0)).julianDay == 1_721_424);
2741 assert(DateTime(Date(0, 12, 31), TimeOfDay(12, 0, 0)).julianDay == 1_721_425);
2743 assert(DateTime(Date(1, 1, 1), TimeOfDay(0, 0, 0)).julianDay == 1_721_425);
2744 assert(DateTime(Date(1, 1, 1), TimeOfDay(12, 0, 0)).julianDay == 1_721_426);
2746 assert(DateTime(Date(1582, 10, 15), TimeOfDay(0, 0, 0)).julianDay == 2_299_160);
2747 assert(DateTime(Date(1582, 10, 15), TimeOfDay(12, 0, 0)).julianDay == 2_299_161);
2749 assert(DateTime(Date(1858, 11, 17), TimeOfDay(0, 0, 0)).julianDay == 2_400_000);
2750 assert(DateTime(Date(1858, 11, 17), TimeOfDay(12, 0, 0)).julianDay == 2_400_001);
2752 assert(DateTime(Date(1982, 1, 4), TimeOfDay(0, 0, 0)).julianDay == 2_444_973);
2753 assert(DateTime(Date(1982, 1, 4), TimeOfDay(12, 0, 0)).julianDay == 2_444_974);
2755 assert(DateTime(Date(1996, 3, 31), TimeOfDay(0, 0, 0)).julianDay == 2_450_173);
2756 assert(DateTime(Date(1996, 3, 31), TimeOfDay(12, 0, 0)).julianDay == 2_450_174);
2758 assert(DateTime(Date(2010, 8, 24), TimeOfDay(0, 0, 0)).julianDay == 2_455_432);
2759 assert(DateTime(Date(2010, 8, 24), TimeOfDay(12, 0, 0)).julianDay == 2_455_433);
2761 const cdt = DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)); argument
2762 immutable idt = DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)); argument
2779 assert(DateTime(Date(1858, 11, 17), TimeOfDay(0, 0, 0)).modJulianDay == 0); argument
2780 assert(DateTime(Date(1858, 11, 17), TimeOfDay(12, 0, 0)).modJulianDay == 0);
2782 assert(DateTime(Date(2010, 8, 24), TimeOfDay(0, 0, 0)).modJulianDay == 55_432);
2783 assert(DateTime(Date(2010, 8, 24), TimeOfDay(12, 0, 0)).modJulianDay == 55_432);
2785 const cdt = DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)); argument
2786 immutable idt = DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)); argument
2793 Converts this $(LREF DateTime) to a string with the format YYYYMMDDTHHMMSS.
2816 assert(DateTime(Date(2010, 7, 4), TimeOfDay(7, 6, 12)).toISOString() == argument
2819 assert(DateTime(Date(1998, 12, 25), TimeOfDay(2, 15, 0)).toISOString() ==
2822 assert(DateTime(Date(0, 1, 5), TimeOfDay(23, 9, 59)).toISOString() ==
2825 assert(DateTime(Date(-4, 1, 5), TimeOfDay(0, 0, 2)).toISOString() ==
2832 assert(DateTime(Date(9, 12, 4), TimeOfDay(0, 0, 0)).toISOString() == "00091204T000000");
2833 assert(DateTime(Date(99, 12, 4), TimeOfDay(5, 6, 12)).toISOString() == "00991204T050612");
2834 … assert(DateTime(Date(999, 12, 4), TimeOfDay(13, 44, 59)).toISOString() == "09991204T134459");
2835 … assert(DateTime(Date(9999, 7, 4), TimeOfDay(23, 59, 59)).toISOString() == "99990704T235959");
2836 … assert(DateTime(Date(10000, 10, 20), TimeOfDay(1, 1, 1)).toISOString() == "+100001020T010101");
2839 assert(DateTime(Date(0, 12, 4), TimeOfDay(0, 12, 4)).toISOString() == "00001204T001204");
2840 assert(DateTime(Date(-9, 12, 4), TimeOfDay(0, 0, 0)).toISOString() == "-00091204T000000");
2841 assert(DateTime(Date(-99, 12, 4), TimeOfDay(5, 6, 12)).toISOString() == "-00991204T050612");
2842 … assert(DateTime(Date(-999, 12, 4), TimeOfDay(13, 44, 59)).toISOString() == "-09991204T134459");
2843 … assert(DateTime(Date(-9999, 7, 4), TimeOfDay(23, 59, 59)).toISOString() == "-99990704T235959");
2844 … assert(DateTime(Date(-10000, 10, 20), TimeOfDay(1, 1, 1)).toISOString() == "-100001020T010101");
2846 const cdt = DateTime(1999, 7, 6, 12, 30, 33); argument
2847 immutable idt = DateTime(1999, 7, 6, 12, 30, 33); argument
2854 Converts this $(LREF DateTime) to a string with the format
2878 assert(DateTime(Date(2010, 7, 4), TimeOfDay(7, 6, 12)).toISOExtString() == argument
2881 assert(DateTime(Date(1998, 12, 25), TimeOfDay(2, 15, 0)).toISOExtString() ==
2884 assert(DateTime(Date(0, 1, 5), TimeOfDay(23, 9, 59)).toISOExtString() ==
2887 assert(DateTime(Date(-4, 1, 5), TimeOfDay(0, 0, 2)).toISOExtString() ==
2894 … assert(DateTime(Date(9, 12, 4), TimeOfDay(0, 0, 0)).toISOExtString() == "0009-12-04T00:00:00");
2895 … assert(DateTime(Date(99, 12, 4), TimeOfDay(5, 6, 12)).toISOExtString() == "0099-12-04T05:06:12");
2896 …assert(DateTime(Date(999, 12, 4), TimeOfDay(13, 44, 59)).toISOExtString() == "0999-12-04T13:44:59"…
2897 …assert(DateTime(Date(9999, 7, 4), TimeOfDay(23, 59, 59)).toISOExtString() == "9999-07-04T23:59:59"…
2898 …assert(DateTime(Date(10000, 10, 20), TimeOfDay(1, 1, 1)).toISOExtString() == "+10000-10-20T01:01:0…
2901 … assert(DateTime(Date(0, 12, 4), TimeOfDay(0, 12, 4)).toISOExtString() == "0000-12-04T00:12:04");
2902 … assert(DateTime(Date(-9, 12, 4), TimeOfDay(0, 0, 0)).toISOExtString() == "-0009-12-04T00:00:00");
2903 …assert(DateTime(Date(-99, 12, 4), TimeOfDay(5, 6, 12)).toISOExtString() == "-0099-12-04T05:06:12");
2904 …assert(DateTime(Date(-999, 12, 4), TimeOfDay(13, 44, 59)).toISOExtString() == "-0999-12-04T13:44:5…
2905 …assert(DateTime(Date(-9999, 7, 4), TimeOfDay(23, 59, 59)).toISOExtString() == "-9999-07-04T23:59:5…
2906 …assert(DateTime(Date(-10000, 10, 20), TimeOfDay(1, 1, 1)).toISOExtString() == "-10000-10-20T01:01:…
2908 const cdt = DateTime(1999, 7, 6, 12, 30, 33); argument
2909 immutable idt = DateTime(1999, 7, 6, 12, 30, 33); argument
2915 Converts this $(LREF DateTime) to a string with the format
2939 assert(DateTime(Date(2010, 7, 4), TimeOfDay(7, 6, 12)).toSimpleString() == argument
2942 assert(DateTime(Date(1998, 12, 25), TimeOfDay(2, 15, 0)).toSimpleString() ==
2945 assert(DateTime(Date(0, 1, 5), TimeOfDay(23, 9, 59)).toSimpleString() ==
2948 assert(DateTime(Date(-4, 1, 5), TimeOfDay(0, 0, 2)).toSimpleString() ==
2955 … assert(DateTime(Date(9, 12, 4), TimeOfDay(0, 0, 0)).toSimpleString() == "0009-Dec-04 00:00:00");
2956 … assert(DateTime(Date(99, 12, 4), TimeOfDay(5, 6, 12)).toSimpleString() == "0099-Dec-04 05:06:12");
2957 …assert(DateTime(Date(999, 12, 4), TimeOfDay(13, 44, 59)).toSimpleString() == "0999-Dec-04 13:44:59…
2958 …assert(DateTime(Date(9999, 7, 4), TimeOfDay(23, 59, 59)).toSimpleString() == "9999-Jul-04 23:59:59…
2959 …assert(DateTime(Date(10000, 10, 20), TimeOfDay(1, 1, 1)).toSimpleString() == "+10000-Oct-20 01:01:…
2962 … assert(DateTime(Date(0, 12, 4), TimeOfDay(0, 12, 4)).toSimpleString() == "0000-Dec-04 00:12:04");
2963 … assert(DateTime(Date(-9, 12, 4), TimeOfDay(0, 0, 0)).toSimpleString() == "-0009-Dec-04 00:00:00");
2964 …assert(DateTime(Date(-99, 12, 4), TimeOfDay(5, 6, 12)).toSimpleString() == "-0099-Dec-04 05:06:12"…
2965 …assert(DateTime(Date(-999, 12, 4), TimeOfDay(13, 44, 59)).toSimpleString() == "-0999-Dec-04 13:44:…
2966 …assert(DateTime(Date(-9999, 7, 4), TimeOfDay(23, 59, 59)).toSimpleString() == "-9999-Jul-04 23:59:…
2967 …assert(DateTime(Date(-10000, 10, 20), TimeOfDay(1, 1, 1)).toSimpleString() == "-10000-Oct-20 01:01…
2969 const cdt = DateTime(1999, 7, 6, 12, 30, 33); argument
2970 immutable idt = DateTime(1999, 7, 6, 12, 30, 33); argument
2977 Converts this $(LREF DateTime) to a string.
2979 This function exists to make it easy to convert a $(LREF DateTime) to a
2982 simply convert a $(LREF DateTime) to a string when using functions such
2994 that $(LREF DateTime) has no `fromString` function, whereas it does have
3006 auto dt = DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)); argument
3007 const cdt = DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)); argument
3008 immutable idt = DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)); argument
3017 Creates a $(LREF DateTime) from a string with the format YYYYMMDDTHHMMSS.
3025 not in the ISO format or if the resulting $(LREF DateTime) would not
3028 static DateTime fromISOString(S)(in S isoString) @safe pure
3046 return DateTime(date, tod); argument
3052 assert(DateTime.fromISOString("20100704T070612") ==
3053 DateTime(Date(2010, 7, 4), TimeOfDay(7, 6, 12)));
3055 assert(DateTime.fromISOString("19981225T021500") ==
3056 DateTime(Date(1998, 12, 25), TimeOfDay(2, 15, 0)));
3058 assert(DateTime.fromISOString("00000105T230959") ==
3059 DateTime(Date(0, 1, 5), TimeOfDay(23, 9, 59)));
3061 assert(DateTime.fromISOString("-00040105T000002") ==
3062 DateTime(Date(-4, 1, 5), TimeOfDay(0, 0, 2)));
3064 assert(DateTime.fromISOString(" 20100704T070612 ") ==
3065 DateTime(Date(2010, 7, 4), TimeOfDay(7, 6, 12)));
3070 assertThrown!DateTimeException(DateTime.fromISOString(""));
3071 assertThrown!DateTimeException(DateTime.fromISOString("20100704000000"));
3072 assertThrown!DateTimeException(DateTime.fromISOString("20100704 000000"));
3073 assertThrown!DateTimeException(DateTime.fromISOString("20100704t000000"));
3074 assertThrown!DateTimeException(DateTime.fromISOString("20100704T000000."));
3075 assertThrown!DateTimeException(DateTime.fromISOString("20100704T000000.0"));
3077 assertThrown!DateTimeException(DateTime.fromISOString("2010-07-0400:00:00"));
3078 assertThrown!DateTimeException(DateTime.fromISOString("2010-07-04 00:00:00"));
3079 assertThrown!DateTimeException(DateTime.fromISOString("2010-07-04t00:00:00"));
3080 assertThrown!DateTimeException(DateTime.fromISOString("2010-07-04T00:00:00."));
3081 assertThrown!DateTimeException(DateTime.fromISOString("2010-07-04T00:00:00.0"));
3083 assertThrown!DateTimeException(DateTime.fromISOString("2010-Jul-0400:00:00"));
3084 assertThrown!DateTimeException(DateTime.fromISOString("2010-Jul-04 00:00:00"));
3085 assertThrown!DateTimeException(DateTime.fromISOString("2010-Jul-04t00:00:00"));
3086 assertThrown!DateTimeException(DateTime.fromISOString("2010-Jul-04T00:00:00"));
3087 assertThrown!DateTimeException(DateTime.fromISOString("2010-Jul-04 00:00:00."));
3088 assertThrown!DateTimeException(DateTime.fromISOString("2010-Jul-04 00:00:00.0"));
3090 assertThrown!DateTimeException(DateTime.fromISOString("2010-12-22T172201"));
3091 assertThrown!DateTimeException(DateTime.fromISOString("2010-Dec-22 17:22:01"));
3093 …assert(DateTime.fromISOString("20101222T172201") == DateTime(Date(2010, 12, 22), TimeOfDay(17, 22,…
3094 …assert(DateTime.fromISOString("19990706T123033") == DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 3…
3095 …assert(DateTime.fromISOString("-19990706T123033") == DateTime(Date(-1999, 7, 6), TimeOfDay(12, 30,…
3096 …assert(DateTime.fromISOString("+019990706T123033") == DateTime(Date(1999, 7, 6), TimeOfDay(12, 30,…
3097 …assert(DateTime.fromISOString("19990706T123033 ") == DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, …
3098 …assert(DateTime.fromISOString(" 19990706T123033") == DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, …
3099 …assert(DateTime.fromISOString(" 19990706T123033 ") == DateTime(Date(1999, 7, 6), TimeOfDay(12, 30,…
3110 … assert(DateTime.fromISOString(to!S("20121221T141516")) == DateTime(2012, 12, 21, 14, 15, 16));
3116 Creates a $(LREF DateTime) from a string with the format
3125 not in the ISO Extended format or if the resulting $(LREF DateTime)
3128 static DateTime fromISOExtString(S)(in S isoExtString) @safe pure
3146 return DateTime(date, tod); argument
3152 assert(DateTime.fromISOExtString("2010-07-04T07:06:12") ==
3153 DateTime(Date(2010, 7, 4), TimeOfDay(7, 6, 12)));
3155 assert(DateTime.fromISOExtString("1998-12-25T02:15:00") ==
3156 DateTime(Date(1998, 12, 25), TimeOfDay(2, 15, 0)));
3158 assert(DateTime.fromISOExtString("0000-01-05T23:09:59") ==
3159 DateTime(Date(0, 1, 5), TimeOfDay(23, 9, 59)));
3161 assert(DateTime.fromISOExtString("-0004-01-05T00:00:02") ==
3162 DateTime(Date(-4, 1, 5), TimeOfDay(0, 0, 2)));
3164 assert(DateTime.fromISOExtString(" 2010-07-04T07:06:12 ") ==
3165 DateTime(Date(2010, 7, 4), TimeOfDay(7, 6, 12)));
3170 assertThrown!DateTimeException(DateTime.fromISOExtString(""));
3171 assertThrown!DateTimeException(DateTime.fromISOExtString("20100704000000"));
3172 assertThrown!DateTimeException(DateTime.fromISOExtString("20100704 000000"));
3173 assertThrown!DateTimeException(DateTime.fromISOExtString("20100704t000000"));
3174 assertThrown!DateTimeException(DateTime.fromISOExtString("20100704T000000."));
3175 assertThrown!DateTimeException(DateTime.fromISOExtString("20100704T000000.0"));
3177 assertThrown!DateTimeException(DateTime.fromISOExtString("2010-07:0400:00:00"));
3178 assertThrown!DateTimeException(DateTime.fromISOExtString("2010-07-04 00:00:00"));
3179 assertThrown!DateTimeException(DateTime.fromISOExtString("2010-07-04 00:00:00"));
3180 assertThrown!DateTimeException(DateTime.fromISOExtString("2010-07-04t00:00:00"));
3181 assertThrown!DateTimeException(DateTime.fromISOExtString("2010-07-04T00:00:00."));
3182 assertThrown!DateTimeException(DateTime.fromISOExtString("2010-07-04T00:00:00.0"));
3184 assertThrown!DateTimeException(DateTime.fromISOExtString("2010-Jul-0400:00:00"));
3185 assertThrown!DateTimeException(DateTime.fromISOExtString("2010-Jul-04t00:00:00"));
3186 assertThrown!DateTimeException(DateTime.fromISOExtString("2010-Jul-04 00:00:00."));
3187 assertThrown!DateTimeException(DateTime.fromISOExtString("2010-Jul-04 00:00:00.0"));
3189 assertThrown!DateTimeException(DateTime.fromISOExtString("20101222T172201"));
3190 assertThrown!DateTimeException(DateTime.fromISOExtString("2010-Dec-22 17:22:01"));
3192 …assert(DateTime.fromISOExtString("2010-12-22T17:22:01") == DateTime(Date(2010, 12, 22), TimeOfDay(…
3193 …assert(DateTime.fromISOExtString("1999-07-06T12:30:33") == DateTime(Date(1999, 7, 6), TimeOfDay(12…
3194 …assert(DateTime.fromISOExtString("-1999-07-06T12:30:33") == DateTime(Date(-1999, 7, 6), TimeOfDay(…
3195 …assert(DateTime.fromISOExtString("+01999-07-06T12:30:33") == DateTime(Date(1999, 7, 6), TimeOfDay(…
3196 …assert(DateTime.fromISOExtString("1999-07-06T12:30:33 ") == DateTime(Date(1999, 7, 6), TimeOfDay(1…
3197 …assert(DateTime.fromISOExtString(" 1999-07-06T12:30:33") == DateTime(Date(1999, 7, 6), TimeOfDay(1…
3198 …assert(DateTime.fromISOExtString(" 1999-07-06T12:30:33 ") == DateTime(Date(1999, 7, 6), TimeOfDay(…
3209 …assert(DateTime.fromISOExtString(to!S("2012-12-21T14:15:16")) == DateTime(2012, 12, 21, 14, 15, 16…
3215 Creates a $(LREF DateTime) from a string with the format
3224 not in the correct format or if the resulting $(LREF DateTime)
3227 static DateTime fromSimpleString(S)(in S simpleString) @safe pure
3245 return DateTime(date, tod); argument
3251 assert(DateTime.fromSimpleString("2010-Jul-04 07:06:12") ==
3252 DateTime(Date(2010, 7, 4), TimeOfDay(7, 6, 12)));
3253 assert(DateTime.fromSimpleString("1998-Dec-25 02:15:00") ==
3254 DateTime(Date(1998, 12, 25), TimeOfDay(2, 15, 0)));
3255 assert(DateTime.fromSimpleString("0000-Jan-05 23:09:59") ==
3256 DateTime(Date(0, 1, 5), TimeOfDay(23, 9, 59)));
3257 assert(DateTime.fromSimpleString("-0004-Jan-05 00:00:02") ==
3258 DateTime(Date(-4, 1, 5), TimeOfDay(0, 0, 2)));
3259 assert(DateTime.fromSimpleString(" 2010-Jul-04 07:06:12 ") ==
3260 DateTime(Date(2010, 7, 4), TimeOfDay(7, 6, 12)));
3265 assertThrown!DateTimeException(DateTime.fromISOString(""));
3266 assertThrown!DateTimeException(DateTime.fromISOString("20100704000000"));
3267 assertThrown!DateTimeException(DateTime.fromISOString("20100704 000000"));
3268 assertThrown!DateTimeException(DateTime.fromISOString("20100704t000000"));
3269 assertThrown!DateTimeException(DateTime.fromISOString("20100704T000000."));
3270 assertThrown!DateTimeException(DateTime.fromISOString("20100704T000000.0"));
3272 assertThrown!DateTimeException(DateTime.fromISOString("2010-07-0400:00:00"));
3273 assertThrown!DateTimeException(DateTime.fromISOString("2010-07-04 00:00:00"));
3274 assertThrown!DateTimeException(DateTime.fromISOString("2010-07-04t00:00:00"));
3275 assertThrown!DateTimeException(DateTime.fromISOString("2010-07-04T00:00:00."));
3276 assertThrown!DateTimeException(DateTime.fromISOString("2010-07-04T00:00:00.0"));
3278 assertThrown!DateTimeException(DateTime.fromISOString("2010-Jul-0400:00:00"));
3279 assertThrown!DateTimeException(DateTime.fromISOString("2010-Jul-04 00:00:00"));
3280 assertThrown!DateTimeException(DateTime.fromISOString("2010-Jul-04t00:00:00"));
3281 assertThrown!DateTimeException(DateTime.fromISOString("2010-Jul-04T00:00:00"));
3282 assertThrown!DateTimeException(DateTime.fromISOString("2010-Jul-04 00:00:00."));
3283 assertThrown!DateTimeException(DateTime.fromISOString("2010-Jul-04 00:00:00.0"));
3285 assertThrown!DateTimeException(DateTime.fromSimpleString("20101222T172201"));
3286 assertThrown!DateTimeException(DateTime.fromSimpleString("2010-12-22T172201"));
3288 assert(DateTime.fromSimpleString("2010-Dec-22 17:22:01") ==
3289 DateTime(Date(2010, 12, 22), TimeOfDay(17, 22, 01)));
3290 assert(DateTime.fromSimpleString("1999-Jul-06 12:30:33") ==
3291 DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)));
3292 assert(DateTime.fromSimpleString("-1999-Jul-06 12:30:33") ==
3293 DateTime(Date(-1999, 7, 6), TimeOfDay(12, 30, 33)));
3294 assert(DateTime.fromSimpleString("+01999-Jul-06 12:30:33") ==
3295 DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)));
3296 assert(DateTime.fromSimpleString("1999-Jul-06 12:30:33 ") ==
3297 DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)));
3298 assert(DateTime.fromSimpleString(" 1999-Jul-06 12:30:33") ==
3299 DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)));
3300 assert(DateTime.fromSimpleString(" 1999-Jul-06 12:30:33 ") ==
3301 DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)));
3312 …assert(DateTime.fromSimpleString(to!S("2012-Dec-21 14:15:16")) == DateTime(2012, 12, 21, 14, 15, 1…
3318 Returns the $(LREF DateTime) farthest in the past which is representable
3319 by $(LREF DateTime).
3321 @property static DateTime min() @safe pure nothrow @nogc in min() argument
3329 auto dt = DateTime.init; argument
3339 assert(DateTime.min.year < 0);
3340 assert(DateTime.min < DateTime.max);
3345 Returns the $(LREF DateTime) farthest in the future which is
3346 representable by $(LREF DateTime).
3348 @property static DateTime max() @safe pure nothrow @nogc in max() argument
3356 auto dt = DateTime.init; argument
3369 assert(DateTime.max.year > 0);
3370 assert(DateTime.max > DateTime.min);
3383 seconds = The number of seconds to add to this $(LREF DateTime).
3385 ref DateTime _addSeconds(long seconds) return @safe pure nothrow @nogc
3415 static void testDT(DateTime orig, int seconds, in DateTime expected, size_t line = __LINE__)
3422 testDT(DateTime(1999, 7, 6, 12, 30, 33), 0, DateTime(1999, 7, 6, 12, 30, 33));
3423 testDT(DateTime(1999, 7, 6, 12, 30, 33), 1, DateTime(1999, 7, 6, 12, 30, 34));
3424 testDT(DateTime(1999, 7, 6, 12, 30, 33), 2, DateTime(1999, 7, 6, 12, 30, 35));
3425 testDT(DateTime(1999, 7, 6, 12, 30, 33), 3, DateTime(1999, 7, 6, 12, 30, 36));
3426 testDT(DateTime(1999, 7, 6, 12, 30, 33), 4, DateTime(1999, 7, 6, 12, 30, 37));
3427 testDT(DateTime(1999, 7, 6, 12, 30, 33), 5, DateTime(1999, 7, 6, 12, 30, 38));
3428 testDT(DateTime(1999, 7, 6, 12, 30, 33), 10, DateTime(1999, 7, 6, 12, 30, 43));
3429 testDT(DateTime(1999, 7, 6, 12, 30, 33), 15, DateTime(1999, 7, 6, 12, 30, 48));
3430 testDT(DateTime(1999, 7, 6, 12, 30, 33), 26, DateTime(1999, 7, 6, 12, 30, 59));
3431 testDT(DateTime(1999, 7, 6, 12, 30, 33), 27, DateTime(1999, 7, 6, 12, 31, 0));
3432 testDT(DateTime(1999, 7, 6, 12, 30, 33), 30, DateTime(1999, 7, 6, 12, 31, 3));
3433 testDT(DateTime(1999, 7, 6, 12, 30, 33), 59, DateTime(1999, 7, 6, 12, 31, 32));
3434 testDT(DateTime(1999, 7, 6, 12, 30, 33), 60, DateTime(1999, 7, 6, 12, 31, 33));
3435 testDT(DateTime(1999, 7, 6, 12, 30, 33), 61, DateTime(1999, 7, 6, 12, 31, 34));
3437 testDT(DateTime(1999, 7, 6, 12, 30, 33), 1766, DateTime(1999, 7, 6, 12, 59, 59));
3438 testDT(DateTime(1999, 7, 6, 12, 30, 33), 1767, DateTime(1999, 7, 6, 13, 0, 0));
3439 testDT(DateTime(1999, 7, 6, 12, 30, 33), 1768, DateTime(1999, 7, 6, 13, 0, 1));
3440 testDT(DateTime(1999, 7, 6, 12, 30, 33), 2007, DateTime(1999, 7, 6, 13, 4, 0));
3441 testDT(DateTime(1999, 7, 6, 12, 30, 33), 3599, DateTime(1999, 7, 6, 13, 30, 32));
3442 testDT(DateTime(1999, 7, 6, 12, 30, 33), 3600, DateTime(1999, 7, 6, 13, 30, 33));
3443 testDT(DateTime(1999, 7, 6, 12, 30, 33), 3601, DateTime(1999, 7, 6, 13, 30, 34));
3444 testDT(DateTime(1999, 7, 6, 12, 30, 33), 7200, DateTime(1999, 7, 6, 14, 30, 33));
3445 testDT(DateTime(1999, 7, 6, 23, 0, 0), 432_123, DateTime(1999, 7, 11, 23, 2, 3));
3447 testDT(DateTime(1999, 7, 6, 12, 30, 33), -1, DateTime(1999, 7, 6, 12, 30, 32));
3448 testDT(DateTime(1999, 7, 6, 12, 30, 33), -2, DateTime(1999, 7, 6, 12, 30, 31));
3449 testDT(DateTime(1999, 7, 6, 12, 30, 33), -3, DateTime(1999, 7, 6, 12, 30, 30));
3450 testDT(DateTime(1999, 7, 6, 12, 30, 33), -4, DateTime(1999, 7, 6, 12, 30, 29));
3451 testDT(DateTime(1999, 7, 6, 12, 30, 33), -5, DateTime(1999, 7, 6, 12, 30, 28));
3452 testDT(DateTime(1999, 7, 6, 12, 30, 33), -10, DateTime(1999, 7, 6, 12, 30, 23));
3453 testDT(DateTime(1999, 7, 6, 12, 30, 33), -15, DateTime(1999, 7, 6, 12, 30, 18));
3454 testDT(DateTime(1999, 7, 6, 12, 30, 33), -33, DateTime(1999, 7, 6, 12, 30, 0));
3455 testDT(DateTime(1999, 7, 6, 12, 30, 33), -34, DateTime(1999, 7, 6, 12, 29, 59));
3456 testDT(DateTime(1999, 7, 6, 12, 30, 33), -35, DateTime(1999, 7, 6, 12, 29, 58));
3457 testDT(DateTime(1999, 7, 6, 12, 30, 33), -59, DateTime(1999, 7, 6, 12, 29, 34));
3458 testDT(DateTime(1999, 7, 6, 12, 30, 33), -60, DateTime(1999, 7, 6, 12, 29, 33));
3459 testDT(DateTime(1999, 7, 6, 12, 30, 33), -61, DateTime(1999, 7, 6, 12, 29, 32));
3461 testDT(DateTime(1999, 7, 6, 12, 30, 33), -1833, DateTime(1999, 7, 6, 12, 0, 0));
3462 testDT(DateTime(1999, 7, 6, 12, 30, 33), -1834, DateTime(1999, 7, 6, 11, 59, 59));
3463 testDT(DateTime(1999, 7, 6, 12, 30, 33), -3600, DateTime(1999, 7, 6, 11, 30, 33));
3464 testDT(DateTime(1999, 7, 6, 12, 30, 33), -3601, DateTime(1999, 7, 6, 11, 30, 32));
3465 testDT(DateTime(1999, 7, 6, 12, 30, 33), -5134, DateTime(1999, 7, 6, 11, 4, 59));
3466 testDT(DateTime(1999, 7, 6, 23, 0, 0), -432_123, DateTime(1999, 7, 1, 22, 57, 57));
3468 testDT(DateTime(1999, 7, 6, 12, 30, 0), 1, DateTime(1999, 7, 6, 12, 30, 1));
3469 testDT(DateTime(1999, 7, 6, 12, 30, 0), 0, DateTime(1999, 7, 6, 12, 30, 0));
3470 testDT(DateTime(1999, 7, 6, 12, 30, 0), -1, DateTime(1999, 7, 6, 12, 29, 59));
3472 testDT(DateTime(1999, 7, 6, 12, 0, 0), 1, DateTime(1999, 7, 6, 12, 0, 1));
3473 testDT(DateTime(1999, 7, 6, 12, 0, 0), 0, DateTime(1999, 7, 6, 12, 0, 0));
3474 testDT(DateTime(1999, 7, 6, 12, 0, 0), -1, DateTime(1999, 7, 6, 11, 59, 59));
3476 testDT(DateTime(1999, 7, 6, 0, 0, 0), 1, DateTime(1999, 7, 6, 0, 0, 1));
3477 testDT(DateTime(1999, 7, 6, 0, 0, 0), 0, DateTime(1999, 7, 6, 0, 0, 0));
3478 testDT(DateTime(1999, 7, 6, 0, 0, 0), -1, DateTime(1999, 7, 5, 23, 59, 59));
3480 testDT(DateTime(1999, 7, 5, 23, 59, 59), 1, DateTime(1999, 7, 6, 0, 0, 0));
3481 testDT(DateTime(1999, 7, 5, 23, 59, 59), 0, DateTime(1999, 7, 5, 23, 59, 59));
3482 testDT(DateTime(1999, 7, 5, 23, 59, 59), -1, DateTime(1999, 7, 5, 23, 59, 58));
3484 testDT(DateTime(1998, 12, 31, 23, 59, 59), 1, DateTime(1999, 1, 1, 0, 0, 0));
3485 testDT(DateTime(1998, 12, 31, 23, 59, 59), 0, DateTime(1998, 12, 31, 23, 59, 59));
3486 testDT(DateTime(1998, 12, 31, 23, 59, 59), -1, DateTime(1998, 12, 31, 23, 59, 58));
3488 testDT(DateTime(1998, 1, 1, 0, 0, 0), 1, DateTime(1998, 1, 1, 0, 0, 1));
3489 testDT(DateTime(1998, 1, 1, 0, 0, 0), 0, DateTime(1998, 1, 1, 0, 0, 0));
3490 testDT(DateTime(1998, 1, 1, 0, 0, 0), -1, DateTime(1997, 12, 31, 23, 59, 59));
3493 testDT(DateTime(-1999, 7, 6, 12, 30, 33), 0, DateTime(-1999, 7, 6, 12, 30, 33));
3494 testDT(DateTime(-1999, 7, 6, 12, 30, 33), 1, DateTime(-1999, 7, 6, 12, 30, 34));
3495 testDT(DateTime(-1999, 7, 6, 12, 30, 33), 2, DateTime(-1999, 7, 6, 12, 30, 35));
3496 testDT(DateTime(-1999, 7, 6, 12, 30, 33), 3, DateTime(-1999, 7, 6, 12, 30, 36));
3497 testDT(DateTime(-1999, 7, 6, 12, 30, 33), 4, DateTime(-1999, 7, 6, 12, 30, 37));
3498 testDT(DateTime(-1999, 7, 6, 12, 30, 33), 5, DateTime(-1999, 7, 6, 12, 30, 38));
3499 testDT(DateTime(-1999, 7, 6, 12, 30, 33), 10, DateTime(-1999, 7, 6, 12, 30, 43));
3500 testDT(DateTime(-1999, 7, 6, 12, 30, 33), 15, DateTime(-1999, 7, 6, 12, 30, 48));
3501 testDT(DateTime(-1999, 7, 6, 12, 30, 33), 26, DateTime(-1999, 7, 6, 12, 30, 59));
3502 testDT(DateTime(-1999, 7, 6, 12, 30, 33), 27, DateTime(-1999, 7, 6, 12, 31, 0));
3503 testDT(DateTime(-1999, 7, 6, 12, 30, 33), 30, DateTime(-1999, 7, 6, 12, 31, 3));
3504 testDT(DateTime(-1999, 7, 6, 12, 30, 33), 59, DateTime(-1999, 7, 6, 12, 31, 32));
3505 testDT(DateTime(-1999, 7, 6, 12, 30, 33), 60, DateTime(-1999, 7, 6, 12, 31, 33));
3506 testDT(DateTime(-1999, 7, 6, 12, 30, 33), 61, DateTime(-1999, 7, 6, 12, 31, 34));
3508 testDT(DateTime(-1999, 7, 6, 12, 30, 33), 1766, DateTime(-1999, 7, 6, 12, 59, 59));
3509 testDT(DateTime(-1999, 7, 6, 12, 30, 33), 1767, DateTime(-1999, 7, 6, 13, 0, 0));
3510 testDT(DateTime(-1999, 7, 6, 12, 30, 33), 1768, DateTime(-1999, 7, 6, 13, 0, 1));
3511 testDT(DateTime(-1999, 7, 6, 12, 30, 33), 2007, DateTime(-1999, 7, 6, 13, 4, 0));
3512 testDT(DateTime(-1999, 7, 6, 12, 30, 33), 3599, DateTime(-1999, 7, 6, 13, 30, 32));
3513 testDT(DateTime(-1999, 7, 6, 12, 30, 33), 3600, DateTime(-1999, 7, 6, 13, 30, 33));
3514 testDT(DateTime(-1999, 7, 6, 12, 30, 33), 3601, DateTime(-1999, 7, 6, 13, 30, 34));
3515 testDT(DateTime(-1999, 7, 6, 12, 30, 33), 7200, DateTime(-1999, 7, 6, 14, 30, 33));
3516 testDT(DateTime(-1999, 7, 6, 23, 0, 0), 432_123, DateTime(-1999, 7, 11, 23, 2, 3));
3518 testDT(DateTime(-1999, 7, 6, 12, 30, 33), -1, DateTime(-1999, 7, 6, 12, 30, 32));
3519 testDT(DateTime(-1999, 7, 6, 12, 30, 33), -2, DateTime(-1999, 7, 6, 12, 30, 31));
3520 testDT(DateTime(-1999, 7, 6, 12, 30, 33), -3, DateTime(-1999, 7, 6, 12, 30, 30));
3521 testDT(DateTime(-1999, 7, 6, 12, 30, 33), -4, DateTime(-1999, 7, 6, 12, 30, 29));
3522 testDT(DateTime(-1999, 7, 6, 12, 30, 33), -5, DateTime(-1999, 7, 6, 12, 30, 28));
3523 testDT(DateTime(-1999, 7, 6, 12, 30, 33), -10, DateTime(-1999, 7, 6, 12, 30, 23));
3524 testDT(DateTime(-1999, 7, 6, 12, 30, 33), -15, DateTime(-1999, 7, 6, 12, 30, 18));
3525 testDT(DateTime(-1999, 7, 6, 12, 30, 33), -33, DateTime(-1999, 7, 6, 12, 30, 0));
3526 testDT(DateTime(-1999, 7, 6, 12, 30, 33), -34, DateTime(-1999, 7, 6, 12, 29, 59));
3527 testDT(DateTime(-1999, 7, 6, 12, 30, 33), -35, DateTime(-1999, 7, 6, 12, 29, 58));
3528 testDT(DateTime(-1999, 7, 6, 12, 30, 33), -59, DateTime(-1999, 7, 6, 12, 29, 34));
3529 testDT(DateTime(-1999, 7, 6, 12, 30, 33), -60, DateTime(-1999, 7, 6, 12, 29, 33));
3530 testDT(DateTime(-1999, 7, 6, 12, 30, 33), -61, DateTime(-1999, 7, 6, 12, 29, 32));
3532 testDT(DateTime(-1999, 7, 6, 12, 30, 33), -1833, DateTime(-1999, 7, 6, 12, 0, 0));
3533 testDT(DateTime(-1999, 7, 6, 12, 30, 33), -1834, DateTime(-1999, 7, 6, 11, 59, 59));
3534 testDT(DateTime(-1999, 7, 6, 12, 30, 33), -3600, DateTime(-1999, 7, 6, 11, 30, 33));
3535 testDT(DateTime(-1999, 7, 6, 12, 30, 33), -3601, DateTime(-1999, 7, 6, 11, 30, 32));
3536 testDT(DateTime(-1999, 7, 6, 12, 30, 33), -5134, DateTime(-1999, 7, 6, 11, 4, 59));
3537 testDT(DateTime(-1999, 7, 6, 12, 30, 33), -7200, DateTime(-1999, 7, 6, 10, 30, 33));
3538 testDT(DateTime(-1999, 7, 6, 23, 0, 0), -432_123, DateTime(-1999, 7, 1, 22, 57, 57));
3540 testDT(DateTime(-1999, 7, 6, 12, 30, 0), 1, DateTime(-1999, 7, 6, 12, 30, 1));
3541 testDT(DateTime(-1999, 7, 6, 12, 30, 0), 0, DateTime(-1999, 7, 6, 12, 30, 0));
3542 testDT(DateTime(-1999, 7, 6, 12, 30, 0), -1, DateTime(-1999, 7, 6, 12, 29, 59));
3544 testDT(DateTime(-1999, 7, 6, 12, 0, 0), 1, DateTime(-1999, 7, 6, 12, 0, 1));
3545 testDT(DateTime(-1999, 7, 6, 12, 0, 0), 0, DateTime(-1999, 7, 6, 12, 0, 0));
3546 testDT(DateTime(-1999, 7, 6, 12, 0, 0), -1, DateTime(-1999, 7, 6, 11, 59, 59));
3548 testDT(DateTime(-1999, 7, 6, 0, 0, 0), 1, DateTime(-1999, 7, 6, 0, 0, 1));
3549 testDT(DateTime(-1999, 7, 6, 0, 0, 0), 0, DateTime(-1999, 7, 6, 0, 0, 0));
3550 testDT(DateTime(-1999, 7, 6, 0, 0, 0), -1, DateTime(-1999, 7, 5, 23, 59, 59));
3552 testDT(DateTime(-1999, 7, 5, 23, 59, 59), 1, DateTime(-1999, 7, 6, 0, 0, 0));
3553 testDT(DateTime(-1999, 7, 5, 23, 59, 59), 0, DateTime(-1999, 7, 5, 23, 59, 59));
3554 testDT(DateTime(-1999, 7, 5, 23, 59, 59), -1, DateTime(-1999, 7, 5, 23, 59, 58));
3556 testDT(DateTime(-2000, 12, 31, 23, 59, 59), 1, DateTime(-1999, 1, 1, 0, 0, 0));
3557 testDT(DateTime(-2000, 12, 31, 23, 59, 59), 0, DateTime(-2000, 12, 31, 23, 59, 59));
3558 testDT(DateTime(-2000, 12, 31, 23, 59, 59), -1, DateTime(-2000, 12, 31, 23, 59, 58));
3560 testDT(DateTime(-2000, 1, 1, 0, 0, 0), 1, DateTime(-2000, 1, 1, 0, 0, 1));
3561 testDT(DateTime(-2000, 1, 1, 0, 0, 0), 0, DateTime(-2000, 1, 1, 0, 0, 0));
3562 testDT(DateTime(-2000, 1, 1, 0, 0, 0), -1, DateTime(-2001, 12, 31, 23, 59, 59));
3565 testDT(DateTime(1, 1, 1, 0, 0, 0), -1, DateTime(0, 12, 31, 23, 59, 59));
3566 testDT(DateTime(0, 12, 31, 23, 59, 59), 1, DateTime(1, 1, 1, 0, 0, 0));
3568 testDT(DateTime(0, 1, 1, 0, 0, 0), -1, DateTime(-1, 12, 31, 23, 59, 59));
3569 testDT(DateTime(-1, 12, 31, 23, 59, 59), 1, DateTime(0, 1, 1, 0, 0, 0));
3571 testDT(DateTime(-1, 1, 1, 11, 30, 33), 63_165_600L, DateTime(1, 1, 1, 13, 30, 33));
3572 testDT(DateTime(1, 1, 1, 13, 30, 33), -63_165_600L, DateTime(-1, 1, 1, 11, 30, 33));
3574 testDT(DateTime(-1, 1, 1, 11, 30, 33), 63_165_617L, DateTime(1, 1, 1, 13, 30, 50));
3575 testDT(DateTime(1, 1, 1, 13, 30, 50), -63_165_617L, DateTime(-1, 1, 1, 11, 30, 33));
3577 const cdt = DateTime(1999, 7, 6, 12, 30, 33);
3578 immutable idt = DateTime(1999, 7, 6, 12, 30, 33);
9585 static assert(isTimePoint!DateTime);
9601 foreach (TP; AliasSeq!(Date, DateTime, SysTime, TimeOfDay))
10125 DateTime[] testDateTimesBC;
10126 DateTime[] testDateTimesAD;
10360 testDateTimesBC ~= DateTime(dt, tod);
10366 testDateTimesAD ~= DateTime(dt, tod);