Menu

- Learn
- Documentation
  - Language Reference
  - Library Reference
  - Command-line Reference
  - Feature Overview
  - Articles
- Packages
- Community
  - Blog
  - Orgs using D
  - Twitter
  - Forums
  - IRC
  - Wiki
  - GitHub
  - Issues
  - Foundation
  - Donate
- Resources
  - Books
  - Tutorials
  - Tools
  - Editors
  - IDEs
  - Visual D
  - Acknowledgments
  - D Style
  - Glossary
  - Sitemap

Search
Report a bug
If you spot a problem with this page, click here to create a Bugzilla issue.
Improve this page
Quickly fork, edit online, and submit a pull request for this page. Requires a signed-in GitHub account. This works well for small changes. If you'd like to make larger changes you may want to consider using a local clone.

# std.datetime

Module containing Date/Time functionality.
This module provides:

- Types to represent points in time: SysTime, Date, TimeOfDay, and DateTime.
- Types to represent intervals of time.
- Types to represent ranges over intervals of time.
- Types to represent time zones (used by SysTime).
- A platform-independent, high precision stopwatch type: StopWatch
- Benchmarking functions.
- Various helper functions.

Closely related to std.`datetime` is core.time, and some of the time types used in std.`datetime` come from there - such as core.time.Duration, core.time.TickDuration, and core.time.FracSec. core.time is publically imported into std.`datetime`, it isn't necessary to import it separately.
Three of the main concepts used in this module are time points, time durations, and time intervals.
A time point is a specific point in time. e.g. January 5th, 2010 or 5:00.
A time duration is a length of time with units. e.g. 5 days or 231 seconds.
A time interval indicates a period of time associated with a fixed point in time. It is either two time points associated with each other, indicating the time starting at the first point up to, but not including, the second point - e.g. [January 5th, 2010 - March 10th, 2010) - or it is a time point and a time duration associated with one another. e.g. January 5th, 2010 and 5 days, indicating [January 5th, 2010 - January 10th, 2010).
Various arithmetic operations are supported between time points and durations (e.g. the difference between two time points is a time duration), and ranges can be gotten from time intervals, so range-based operations may be done on a series of time points.
The types that the typical user is most likely to be interested in are Date (if they want dates but don't care about time), DateTime (if they want dates and times but don't care about time zones), SysTime (if they want the date and time from the OS and/or do care about time zones), and StopWatch (a platform-independent, high precision stop watch). Date and DateTime are optimized for calendar-based operations, while SysTime is designed for dealing with time from the OS. Check out their specific documentation for more details.
To get the current time, use Clock.currTime. It will return the current time as a SysTime. To print it, toString is sufficient, but if using toISOString, toISOExtString, or toSimpleString, use the corresponding fromISOString, fromISOExtString, or fromSimpleString to create a SysTime from the string.

    auto currentTime = Clock.currTime();
    auto timeString = currentTime.toISOExtString();
    auto restoredTime = SysTime.fromISOExtString(timeString);

Various functions take a string (or strings) to represent a unit of time (e.g. convert!("days", "hours")(numDays)). The valid strings to use with such functions are "years", "months", "weeks", "days", "hours", "minutes", "seconds", "msecs" (milliseconds), "usecs" (microseconds), "hnsecs" (hecto-nanoseconds - i.e. 100 ns), or some subset thereof. There are a few functions in core.time which take "nsecs", but because nothing in std.`datetime` has precision greater than hnsecs, and very little in core.time does, no functions in std.`datetime` accept "nsecs". To remember which units are abbreviated and which aren't, all units seconds and greater use their full names, and all sub-second units are abbreviated (since they'd be rather long if they weren't).

Note: DateTimeException is an alias for core.time.TimeException, so you don't need to worry about core.time functions and std.`datetime` functions throwing different exception types (except in the rare case that they throw something other than core.time.TimeException or DateTimeException).

See Also:
Introduction to std.datetime
ISO 8601
Wikipedia entry on TZ Database
List of Time Zones
License:
Boost License 1.0.
Authors:
Jonathan M Davis and Kato Shoichi

Source: std/datetime.d

enum `Month`: ubyte;
  Represents the 12 months of the Gregorian year (January is 1).
  `jan`
  `feb`
  `mar`
  `apr`
  `may`
  `jun`
  `jul`
  `aug`
  `sep`
  `oct`
  `nov`
  `dec`
enum `DayOfWeek`: ubyte;
  Represents the 7 days of the Gregorian week (Sunday is 0).
  `sun`
  `mon`
  `tue`
  `wed`
  `thu`
  `fri`
  `sat`
alias `AllowDayOverflow` = std.typecons.Flag!"allowDayOverflow".Flag;
  In some date calculations, adding months or years can cause the date to fall on a day of the month which is not valid (e.g. February 29th 2001 or June 31st 2000). If overflow is allowed (as is the default), then the month will be incremented accordingly (so, February 29th 2001 would become March 1st 2001, and June 31st 2000 would become July 1st 2000). If overflow is not allowed, then the day will be adjusted to the last valid day in that month (so, February 29th 2001 would become February 28th 2001 and June 31st 2000 would become June 30th 2000).
  `AllowDayOverflow` only applies to calculations involving months or years.
  If set to `AllowDayOverflow`.no, then day overflow is not allowed.
  Otherwise, if set to `AllowDayOverflow`.yes, then day overflow is allowed.
enum `Direction`: int;
  Indicates a direction in time. One example of its use is Interval's expand function which uses it to indicate whether the interval should be expanded backwards (into the past), forwards (into the future), or both.
  `bwd`
    Backward.
  `fwd`
    Forward.
  `both`
    Both backward and forward.
alias `PopFirst` = std.typecons.Flag!"popFirst".Flag;
  Used to indicate whether popFront should be called immediately upon creating a range. The idea is that for some functions used to generate a range for an interval, front is not necessarily a time point which would ever be generated by the range. To get the first time point in the range to match what the function generates, then use `PopFirst`.yes to indicate that the range should have popFront called on it before the range is returned so that front is a time point which the function would generate.
  For instance, if the function used to generate a range of time points generated successive Easters (i.e. you're iterating over all of the Easters within the interval), the initial date probably isn't an Easter. Using `PopFirst`.yes would tell the function which returned the range that popFront was to be called so that front would then be an Easter - the next one generated by the function (which when iterating forward would be the Easter following the original front, while when iterating backward, it would be the Easter prior to the original front). If `PopFirst`.no were used, then front would remain the original time point and it would not necessarily be a time point which would be generated by the range-generating function (which in many cases is exactly what is desired - e.g. if iterating over every day starting at the beginning of the interval).
  If set to `PopFirst`.no, then popFront is not called before returning the range.
  Otherwise, if set to `PopFirst`.yes, then popFront is called before returning the range.
alias `AutoStart` = std.typecons.Flag!"autoStart".Flag;
  Used by StopWatch to indicate whether it should start immediately upon construction.
  If set to `AutoStart`.no, then the stopwatch is not started when it is constructed.
  Otherwise, if set to `AutoStart`.yes, then the stopwatch is started when it is constructed.
immutable string[] `timeStrings`;
  Array of the strings representing time units, starting with the smallest unit and going to the largest. It does not include "nsecs".
  Includes "hnsecs" (hecto-nanoseconds (100 ns)), "usecs" (microseconds), "msecs" (milliseconds), "seconds", "minutes", "hours", "days", "weeks", "months", and "years"
alias `DateTimeException` = core.time.TimeException;
  Exception type used by std.datetime. It's an alias to core.time.TimeException. Either can be caught without concern about which module it came from.
class `Clock`;
  Effectively a namespace to make it clear that the methods it contains are getting the time from the system clock. It cannot be instantiated.
  @safe SysTime `currTime`(ClockType clockType = ClockType.normal)(immutable TimeZone `tz` = LocalTime());
    Returns the current time in the given time zone.
    Parameters:

    clockType | The core.time.ClockType indicates which system clock to use to get the current time. Very few programs need to use anything other than the default.
    TimeZone `tz` | The time zone for the SysTime that's returned.

    Throws:
    DateTimeException if it fails to get the time.
  @property @trusted long `currStdTime`(ClockType clockType = ClockType.normal)();
    Returns the number of hnsecs since midnight, January 1st, 1 A.D. for the current time.
    Parameters:

    clockType | The core.time.ClockType indicates which system clock to use to get the current time. Very few programs need to use anything other than the default.

    Throws:
    DateTimeException if it fails to get the time.
  deprecated static nothrow @property @safe TickDuration `currSystemTick`();
    Deprecated. core.time.TickDuration is going to be deprecated in favor of core.time.MonoTime. Use MonoTime.currTime instead. `currSystemTick` will be removed in January 2017.
    The current system tick. The number of ticks per second varies from system to system. `currSystemTick` uses a monotonic clock, so it's intended for precision timing by comparing relative time values, not for getting the current system time.

    Warning: On some systems, the monotonic clock may stop counting when the computer goes to sleep or hibernates. So, the monotonic clock could be off if that occurs. This is known to happen on Mac OS X. It has not been tested whether it occurs on either Windows or Linux.

    Throws:
    DateTimeException if it fails to get the time.
  deprecated static @property @safe TickDuration `currAppTick`();
    Deprecated. core.time.TickDuration is going to be deprecated in favor of core.time.MonoTime. To duplicate the behavior of `currAppTick` with MonoTime, store the value of MonoTime.currTime when the program starts, and then subtract it from the current value of MonoTime.currTime in order to determine how long the program has been running. `currAppTick` will be removed in January 2017.

        immutable MonoTime startupTime;
        shared static this()
        {
            startupTime = MonoTime.currTime;
        }
        Duration timeSinceProgramStarted()
        {
            return MonoTime.currTime - startupTime;
        }

    The current number of system ticks since the application started. The number of ticks per second varies from system to system. This uses a monotonic clock.

    Warning: On some systems, the monotonic clock may stop counting when the computer goes to sleep or hibernates. So, the monotonic clock could be off if that occurs. This is known to happen on Mac OS X. It has not been tested whether it occurs on either Windows or on Linux.

    Throws:
    DateTimeException if it fails to get the time.
struct `SysTime`;
  `SysTime` is the type used to get the current time from the system or doing anything that involves time zones. Unlike DateTime, the time zone is an integral part of `SysTime` (though for local time applications, time zones can be ignored and it will work, since it defaults to using the local time zone). It holds its internal time in std time (hnsecs since midnight, January 1st, 1 A.D. UTC), so it interfaces well with the system time. However, that means that, unlike DateTime, it is not optimized for calendar-based operations, and getting individual units from it such as years or days is going to involve conversions and be less efficient.
  For calendar-based operations that don't care about time zones, then DateTime would be the type to use. For system time, use `SysTime`.
  Clock.currTime will return the current time as a `SysTime`. To convert a `SysTime` to a Date or DateTime, simply cast it. To convert a Date or DateTime to a `SysTime`, use `SysTime`'s constructor, and pass in the intended time zone with it (or don't pass in a TimeZone, and the local time zone will be used). Be aware, however, that converting from a DateTime to a `SysTime` will not necessarily be 100% accurate due to DST (one hour of the year doesn't exist and another occurs twice). To not risk any conversion errors, keep times as `SysTime`s. Aside from DST though, there shouldn't be any conversion problems.
  For using time zones other than local time or UTC, use PosixTimeZone on Posix systems (or on Windows, if providing the TZ Database files), and use WindowsTimeZone on Windows systems. The time in `SysTime` is kept internally in hnsecs from midnight, January 1st, 1 A.D. UTC. Conversion error cannot happen when changing the time zone of a `SysTime`. LocalTime is the TimeZone class which represents the local time, and UTC is the TimeZone class which represents UTC. `SysTime` uses LocalTime if no TimeZone is provided. For more details on time zones, see the documentation for TimeZone, PosixTimeZone, and WindowsTimeZone.
  `SysTime`'s range is from approximately 29,000 B.C. to approximately 29,000 A.D.
  nothrow @safe this(in DateTime `dateTime`, immutable TimeZone `tz` = null);
    Parameters:

    DateTime `dateTime` | The DateTime to use to set this SysTime's internal std time. As DateTime has no concept of time zone, `tz` is used as its time zone.
    TimeZone `tz` | The TimeZone to use for this SysTime. If `null`, LocalTime will be used. The given DateTime is assumed to be in the given time zone.

  @safe this(in DateTime `dateTime`, in Duration `fracSecs`, immutable TimeZone `tz` = null);
    Parameters:

    DateTime `dateTime` | The DateTime to use to set this SysTime's internal std time. As DateTime has no concept of time zone, `tz` is used as its time zone.
    Duration `fracSecs` | The fractional seconds portion of the time.
    TimeZone `tz` | The TimeZone to use for this SysTime. If `null`, LocalTime will be used. The given DateTime is assumed to be in the given time zone.

    Throws:
    DateTimeException if `fracSecs` is negative or if it's greater than or equal to one second.
  nothrow @safe this(in Date `date`, immutable TimeZone `tz` = null);
    Parameters:

    Date `date` | The Date to use to set this SysTime's internal std time. As Date has no concept of time zone, `tz` is used as its time zone.
    TimeZone `tz` | The TimeZone to use for this SysTime. If `null`, LocalTime will be used. The given Date is assumed to be in the given time zone.

  pure nothrow @safe this(long `stdTime`, immutable TimeZone `tz` = null);

    Note: Whereas the other constructors take in the given date/time, assume that it's in the given time zone, and convert it to hnsecs in UTC since midnight, January 1st, 1 A.D. UTC - i.e. std time - this constructor takes a std time, which is specifically already in UTC, so no conversion takes place. Of course, the various getter properties and functions will use the given time zone's conversion function to convert the results to that time zone, but no conversion of the arguments to this constructor takes place.

    Parameters:

    long `stdTime` | The number of hnsecs since midnight, January 1st, 1 A.D. UTC.
    TimeZone `tz` | The TimeZone to use for this SysTime. If `null`, LocalTime will be used.

  pure nothrow ref return @safe SysTime `opAssign`(ref const SysTime `rhs`);
    Parameters:

    SysTime `rhs` | The SysTime to assign to this one.

  pure nothrow ref return @safe SysTime `opAssign`(SysTime `rhs`);
    Parameters:

    SysTime `rhs` | The SysTime to assign to this one.

  const pure nothrow @safe bool `opEquals`(const SysTime `rhs`);
  const pure nothrow @safe bool `opEquals`(ref const SysTime `rhs`);
    Checks for equality between this SysTime and the given SysTime.
    Note that the time zone is ignored. Only the internal std times (which are in UTC) are compared.
  const pure nothrow @safe int `opCmp`(in SysTime `rhs`);
    Compares this SysTime with the given SysTime.
    Time zone is irrelevant when comparing SysTimes.
    Returns:

    this < `rhs` | < 0
    this == `rhs` | 0
    this > `rhs` | > 0

  const pure nothrow @nogc @safe size_t `toHash`();
    Returns:
    A hash of the SysTime
  const nothrow @property @safe short `year`();
    Year of the Gregorian Calendar. Positive numbers are A.D. Non-positive are B.C.
  @property @safe void `year`(int `year`);
    Year of the Gregorian Calendar. Positive numbers are A.D. Non-positive are B.C.
    Parameters:

    int `year` | The `year` to set this SysTime's `year` to.

    Throws:
    DateTimeException if the new `year` is not a leap `year` and the resulting date would be on February 29th.
    Examples:

        assert(SysTime(DateTime(1999, 7, 6, 9, 7, 5)).year == 1999);
        assert(SysTime(DateTime(2010, 10, 4, 0, 0, 30)).year == 2010);
        assert(SysTime(DateTime(-7, 4, 5, 7, 45, 2)).year == -7);

  const @property @safe ushort `yearBC`();
    Year B.C. of the Gregorian Calendar counting year 0 as 1 B.C.
    Throws:
    DateTimeException if isAD is `true`.
    Examples:

        assert(SysTime(DateTime(0, 1, 1, 12, 30, 33)).yearBC == 1);
        assert(SysTime(DateTime(-1, 1, 1, 10, 7, 2)).yearBC == 2);
        assert(SysTime(DateTime(-100, 1, 1, 4, 59, 0)).yearBC == 101);

  @property @safe void `yearBC`(int `year`);
    Year B.C. of the Gregorian Calendar counting `year` 0 as 1 B.C.
    Parameters:

    int `year` | The `year` B.C. to set this SysTime's `year` to.

    Throws:
    DateTimeException if a non-positive value is given.
  const nothrow @property @safe Month `month`();
    Month of a Gregorian Year.
    Examples:

        assert(SysTime(DateTime(1999, 7, 6, 9, 7, 5)).month == 7);
        assert(SysTime(DateTime(2010, 10, 4, 0, 0, 30)).month == 10);
        assert(SysTime(DateTime(-7, 4, 5, 7, 45, 2)).month == 4);

  @property @safe void `month`(Month `month`);
    Month of a Gregorian Year.
    Parameters:

    Month `month` | The `month` to set this SysTime's `month` to.

    Throws:
    DateTimeException if the given `month` is not a valid `month`.
  const nothrow @property @safe ubyte `day`();
    Day of a Gregorian Month.
    Examples:

        assert(SysTime(DateTime(1999, 7, 6, 9, 7, 5)).day == 6);
        assert(SysTime(DateTime(2010, 10, 4, 0, 0, 30)).day == 4);
        assert(SysTime(DateTime(-7, 4, 5, 7, 45, 2)).day == 5);

  @property @safe void `day`(int `day`);
    Day of a Gregorian Month.
    Parameters:

    int `day` | The `day` of the month to set this SysTime's `day` to.

    Throws:
    DateTimeException if the given `day` is not a valid `day` of the current month.
  const nothrow @property @safe ubyte `hour`();
    Hours past midnight.
  @property @safe void `hour`(int `hour`);
    Hours past midnight.
    Parameters:

    int `hour` | The hours to set this SysTime's `hour` to.

    Throws:
    DateTimeException if the given `hour` are not a valid `hour` of the day.
  const nothrow @property @safe ubyte `minute`();
    Minutes past the current hour.
  @property @safe void `minute`(int `minute`);
    Minutes past the current hour.
    Parameters:

    int `minute` | The `minute` to set this SysTime's `minute` to.

    Throws:
    DateTimeException if the given `minute` are not a valid `minute` of an hour.
  const nothrow @property @safe ubyte `second`();
    Seconds past the current minute.
  @property @safe void `second`(int `second`);
    Seconds past the current minute.
    Parameters:

    int `second` | The `second` to set this SysTime's `second` to.

    Throws:
    DateTimeException if the given `second` are not a valid `second` of a minute.
  const nothrow @property @safe Duration `fracSecs`();
    Fractional seconds past the second (i.e. the portion of a SysTime which is less than a second).
    Examples:

        auto dt = DateTime(1982, 4, 1, 20, 59, 22);
        assert(SysTime(dt, msecs(213)).fracSecs == msecs(213));
        assert(SysTime(dt, usecs(5202)).fracSecs == usecs(5202));
        assert(SysTime(dt, hnsecs(1234567)).fracSecs == hnsecs(1234567));

        // SysTime and Duration both have a precision of hnsecs (100 ns),
        // so nsecs are going to be truncated.
        assert(SysTime(dt, nsecs(123456789)).fracSecs == nsecs(123456700));

  @property @safe void `fracSecs`(Duration `fracSecs`);
    Fractional seconds past the second (i.e. the portion of a SysTime which is less than a second).
    Parameters:

    Duration `fracSecs` | The duration to set this SysTime's fractional seconds to.

    Throws:
    DateTimeException if the given duration is negative or if it's greater than or equal to one second.
    Examples:

        auto st = SysTime(DateTime(1982, 4, 1, 20, 59, 22));
        assert(st.fracSecs == Duration.zero);

        st.fracSecs = msecs(213);
        assert(st.fracSecs == msecs(213));

        st.fracSecs = hnsecs(1234567);
        assert(st.fracSecs == hnsecs(1234567));

        // SysTime has a precision of hnsecs (100 ns), so nsecs are
        // going to be truncated.
        st.fracSecs = nsecs(123456789);
        assert(st.fracSecs == hnsecs(1234567));

  const pure nothrow @property @safe long `stdTime`();
    The total hnsecs from midnight, January 1st, 1 A.D. UTC. This is the internal representation of SysTime.
  pure nothrow @property @safe void `stdTime`(long `stdTime`);
    The total hnsecs from midnight, January 1st, 1 A.D. UTC. This is the internal representation of SysTime.
    Parameters:

    long `stdTime` | The number of hnsecs since January 1st, 1 A.D. UTC.

  const pure nothrow @property @safe immutable(TimeZone) `timezone`();
    The current time zone of this SysTime. Its internal time is always kept in UTC, so there are no conversion issues between time zones due to DST. Functions which return all or part of the time - such as hours - adjust the time to this SysTime's time zone before returning.
  pure nothrow @property @safe void `timezone`(immutable TimeZone `timezone`);
    The current time zone of this SysTime. It's internal time is always kept in UTC, so there are no conversion issues between time zones due to DST. Functions which return all or part of the time - such as hours - adjust the time to this SysTime's time zone before returning.
    Parameters:

    TimeZone `timezone` | The TimeZone to set this SysTime's time zone to.

  const nothrow @property @safe bool `dstInEffect`();
    Returns whether DST is in effect for this SysTime.
  const nothrow @property @safe Duration `utcOffset`();
    Returns what the offset from UTC is for this SysTime. It includes the DST offset in effect at that time (if any).
  const pure nothrow @safe SysTime `toLocalTime`();
    Returns a SysTime with the same std time as this one, but with LocalTime as its time zone.
  const pure nothrow @safe SysTime `toUTC`();
    Returns a SysTime with the same std time as this one, but with UTC as its time zone.
  const pure nothrow @safe SysTime `toOtherTZ`(immutable TimeZone `tz`);
    Returns a SysTime with the same std time as this one, but with given time zone as its time zone.
  const pure nothrow @safe T `toUnixTime`(T = time_t)()
  if (is(T == int) || is(T == long));
    Converts this SysTime to unix time (i.e. seconds from midnight, January 1st, 1970 in UTC).
    The C standard does not specify the representation of time_t, so it is implementation defined. On POSIX systems, unix time is equivalent to time_t, but that's not necessarily `true` on other systems (e.g. it is not `true` for the Digital Mars C runtime). So, be careful when using unix time with C functions on non-POSIX systems.
    By default, the return type is time_t (which is normally an alias for int on 32-bit systems and long on 64-bit systems), but if a different size is required than either int or long can be passed as a template argument to get the desired size.
    If the return type is int, and the result can't fit in an int, then the closest value that can be held in 32 bits will be used (so int.max if it goes over and int.min if it goes under). However, no attempt is made to deal with integer overflow if the return type is long.
    Parameters:

    T | The return type (int or long). It defaults to time_t, which is normally 32 bits on a 32-bit system and 64 bits on a 64-bit system.

    Returns:
    A signed integer representing the unix time which is equivalent to this SysTime.
    Examples:

        assert(SysTime(DateTime(1970, 1, 1), UTC()).toUnixTime() == 0);

        auto pst = new immutable SimpleTimeZone(hours(-8));
        assert(SysTime(DateTime(1970, 1, 1), pst).toUnixTime() == 28800);

        auto utc = SysTime(DateTime(2007, 12, 22, 8, 14, 45), UTC());
        assert(utc.toUnixTime() == 1_198_311_285);

        auto ca = SysTime(DateTime(2007, 12, 22, 8, 14, 45), pst);
        assert(ca.toUnixTime() == 1_198_340_085);

  static pure nothrow @safe SysTime `fromUnixTime`(long `unixTime`, immutable TimeZone `tz` = LocalTime());
    Converts from unix time (i.e. seconds from midnight, January 1st, 1970 in UTC) to a SysTime.
    The C standard does not specify the representation of time_t, so it is implementation defined. On POSIX systems, unix time is equivalent to time_t, but that's not necessarily `true` on other systems (e.g. it is not `true` for the Digital Mars C runtime). So, be careful when using unix time with C functions on non-POSIX systems.
    Parameters:

    long `unixTime` | Seconds from midnight, January 1st, 1970 in UTC.
    TimeZone `tz` | The time zone for the SysTime that's returned.

    Examples:

        assert(SysTime.fromUnixTime(0) ==
               SysTime(DateTime(1970, 1, 1), UTC()));

        auto pst = new immutable SimpleTimeZone(hours(-8));
        assert(SysTime.fromUnixTime(28800) ==
               SysTime(DateTime(1970, 1, 1), pst));

        auto st1 = SysTime.fromUnixTime(1_198_311_285, UTC());
        assert(st1 == SysTime(DateTime(2007, 12, 22, 8, 14, 45), UTC()));
        assert(st1.timezone is UTC());
        assert(st1 == SysTime(DateTime(2007, 12, 22, 0, 14, 45), pst));

        auto st2 = SysTime.fromUnixTime(1_198_311_285, pst);
        assert(st2 == SysTime(DateTime(2007, 12, 22, 8, 14, 45), UTC()));
        assert(st2.timezone is pst);
        assert(st2 == SysTime(DateTime(2007, 12, 22, 0, 14, 45), pst));

  const pure nothrow @safe timeval `toTimeVal`();
    Returns a timeval which represents this SysTime.
    Note that like all conversions in std.datetime, this is a truncating conversion.
    If timeval.tv_sec is int, and the result can't fit in an int, then the closest value that can be held in 32 bits will be used for tv_sec. (so int.max if it goes over and int.min if it goes under).
  const pure nothrow @safe timespec `toTimeSpec`();
    Returns a timespec which represents this SysTime.
    This function is Posix-Only.
  const nothrow @safe tm `toTM`();
    Returns a tm which represents this SysTime.
  nothrow ref @safe SysTime `add`(string units)(long `value`, AllowDayOverflow `allowOverflow` = Yes.allowDayOverflow)
  if (units == "years" || units == "months");
    Adds the given number of years or months to this SysTime. A negative number will subtract.
    Note that if day overflow is allowed, and the date with the adjusted year/month overflows the number of days in the new month, then the month will be incremented by one, and the day set to the number of days overflowed. (e.g. if the day were 31 and the new month were June, then the month would be incremented to July, and the new day would be 1). If day overflow is not allowed, then the day will be set to the last valid day in the month (e.g. June 31st would become June 30th).
    Parameters:

    units | The type of units to `add` ("years" or "months").
    long `value` | The number of months or years to `add` to this SysTime.
    AllowDayOverflow `allowOverflow` | Whether the days should be allowed to overflow, causing the month to increment.

  nothrow ref @safe SysTime `roll`(string units)(long `value`, AllowDayOverflow `allowOverflow` = Yes.allowDayOverflow)
  if (units == "years");
    Adds the given number of years or months to this SysTime. A negative number will subtract.
    The difference between rolling and adding is that rolling does not affect larger units. Rolling a SysTime 12 months gets the exact same SysTime. However, the days can still be affected due to the differing number of days in each month.
    Because there are no units larger than years, there is no difference between adding and rolling years.
    Parameters:

    units | The type of units to add ("years" or "months").
    long `value` | The number of months or years to add to this SysTime.
    AllowDayOverflow `allowOverflow` | Whether the days should be allowed to overflow, causing the month to increment.

    Examples:

        import std.typecons : No;

        auto st1 = SysTime(DateTime(2010, 1, 1, 12, 33, 33));
        st1.roll!"months"(1);
        assert(st1 == SysTime(DateTime(2010, 2, 1, 12, 33, 33)));

        auto st2 = SysTime(DateTime(2010, 1, 1, 12, 33, 33));
        st2.roll!"months"(-1);
        assert(st2 == SysTime(DateTime(2010, 12, 1, 12, 33, 33)));

        auto st3 = SysTime(DateTime(1999, 1, 29, 12, 33, 33));
        st3.roll!"months"(1);
        assert(st3 == SysTime(DateTime(1999, 3, 1, 12, 33, 33)));

        auto st4 = SysTime(DateTime(1999, 1, 29, 12, 33, 33));
        st4.roll!"months"(1, No.allowDayOverflow);
        assert(st4 == SysTime(DateTime(1999, 2, 28, 12, 33, 33)));

        auto st5 = SysTime(DateTime(2000, 2, 29, 12, 30, 33));
        st5.roll!"years"(1);
        assert(st5 == SysTime(DateTime(2001, 3, 1, 12, 30, 33)));

        auto st6 = SysTime(DateTime(2000, 2, 29, 12, 30, 33));
        st6.roll!"years"(1, No.allowDayOverflow);
        assert(st6 == SysTime(DateTime(2001, 2, 28, 12, 30, 33)));

  nothrow ref @safe SysTime `roll`(string units)(long `value`)
  if (units == "days");
    Adds the given number of units to this SysTime. A negative number will subtract.
    The difference between rolling and adding is that rolling does not affect larger units. For instance, rolling a SysTime one year's worth of days gets the exact same SysTime.
    Accepted units are "days", "minutes", "hours", "minutes", "seconds", "msecs", "usecs", and "hnsecs".
    Note that when rolling msecs, usecs or hnsecs, they all add up to a second. So, for example, rolling 1000 msecs is exactly the same as rolling 100,000 usecs.
    Parameters:

    units | The units to add.
    long `value` | The number of units to add to this SysTime.

    Examples:

        auto st1 = SysTime(DateTime(2010, 1, 1, 11, 23, 12));
        st1.roll!"days"(1);
        assert(st1 == SysTime(DateTime(2010, 1, 2, 11, 23, 12)));
        st1.roll!"days"(365);
        assert(st1 == SysTime(DateTime(2010, 1, 26, 11, 23, 12)));
        st1.roll!"days"(-32);
        assert(st1 == SysTime(DateTime(2010, 1, 25, 11, 23, 12)));

        auto st2 = SysTime(DateTime(2010, 7, 4, 12, 0, 0));
        st2.roll!"hours"(1);
        assert(st2 == SysTime(DateTime(2010, 7, 4, 13, 0, 0)));

        auto st3 = SysTime(DateTime(2010, 2, 12, 12, 0, 0));
        st3.roll!"hours"(-1);
        assert(st3 == SysTime(DateTime(2010, 2, 12, 11, 0, 0)));

        auto st4 = SysTime(DateTime(2009, 12, 31, 0, 0, 0));
        st4.roll!"minutes"(1);
        assert(st4 == SysTime(DateTime(2009, 12, 31, 0, 1, 0)));

        auto st5 = SysTime(DateTime(2010, 1, 1, 0, 0, 0));
        st5.roll!"minutes"(-1);
        assert(st5 == SysTime(DateTime(2010, 1, 1, 0, 59, 0)));

        auto st6 = SysTime(DateTime(2009, 12, 31, 0, 0, 0));
        st6.roll!"seconds"(1);
        assert(st6 == SysTime(DateTime(2009, 12, 31, 0, 0, 1)));

        auto st7 = SysTime(DateTime(2010, 1, 1, 0, 0, 0));
        st7.roll!"seconds"(-1);
        assert(st7 == SysTime(DateTime(2010, 1, 1, 0, 0, 59)));

        auto dt = DateTime(2010, 1, 1, 0, 0, 0);
        auto st8 = SysTime(dt);
        st8.roll!"msecs"(1);
        assert(st8 == SysTime(dt, msecs(1)));

        auto st9 = SysTime(dt);
        st9.roll!"msecs"(-1);
        assert(st9 == SysTime(dt, msecs(999)));

        auto st10 = SysTime(dt);
        st10.roll!"hnsecs"(1);
        assert(st10 == SysTime(dt, hnsecs(1)));

        auto st11 = SysTime(dt);
        st11.roll!"hnsecs"(-1);
        assert(st11 == SysTime(dt, hnsecs(9_999_999)));

  const pure nothrow @safe SysTime `opBinary`(string op)(Duration `duration`)
  if (op == "+" || op == "-");
    Gives the result of adding or subtracting a core.time.Duration from this SysTime.
    The legal types of arithmetic for SysTime using this operator are

    SysTime | + | Duration | --> | SysTime
    SysTime | - | Duration | --> | SysTime

    Parameters:

    Duration `duration` | The core.time.Duration to add to or subtract from this SysTime.

    Examples:

        assert(SysTime(DateTime(2015, 12, 31, 23, 59, 59)) + seconds(1) ==
               SysTime(DateTime(2016, 1, 1, 0, 0, 0)));

        assert(SysTime(DateTime(2015, 12, 31, 23, 59, 59)) + hours(1) ==
               SysTime(DateTime(2016, 1, 1, 0, 59, 59)));

        assert(SysTime(DateTime(2016, 1, 1, 0, 0, 0)) - seconds(1) ==
               SysTime(DateTime(2015, 12, 31, 23, 59, 59)));

        assert(SysTime(DateTime(2016, 1, 1, 0, 59, 59)) - hours(1) ==
               SysTime(DateTime(2015, 12, 31, 23, 59, 59)));

  const pure nothrow @safe SysTime `opBinary`(string op)(TickDuration `td`)
  if (op == "+" || op == "-");
    Deprecated. core.time.TickDuration is going to be deprecated in favor of core.time.MonoTime and core.time.Duration. Use Duration instead. This overload will be removed in January 2017.
    Defines + and - with core.time.TickDuration.
  pure nothrow ref @safe SysTime `opOpAssign`(string op)(Duration `duration`)
  if (op == "+" || op == "-");
    Gives the result of adding or subtracting a core.time.Duration from this SysTime, as well as assigning the result to this SysTime.
    The legal types of arithmetic for SysTime using this operator are

    SysTime | + | Duration | --> | SysTime
    SysTime | - | Duration | --> | SysTime

    Parameters:

    Duration `duration` | The core.time.Duration to add to or subtract from this SysTime.

  pure nothrow ref @safe SysTime `opOpAssign`(string op)(TickDuration `td`)
  if (op == "+" || op == "-");
    Deprecated. core.time.TickDuration is going to be deprecated in favor of core.time.MonoTime and core.time.Duration. Use Duration instead. This overload will be removed in January 2017.
    Defines += and -= with core.time.TickDuration.
  const pure nothrow @safe Duration `opBinary`(string op)(in SysTime `rhs`)
  if (op == "-");
    Gives the difference between two SysTimes.
    The legal types of arithmetic for SysTime using this operator are

    SysTime | - | SysTime | --> | duration

  const nothrow @safe int `diffMonths`(in SysTime `rhs`);
    Returns the difference between the two SysTimes in months.
    To get the difference in years, subtract the year property of two SysTimes. To get the difference in days or weeks, subtract the SysTimes themselves and use the core.time.Duration that results. Because converting between months and smaller units requires a specific date (which core.time.Durations don't have), getting the difference in months requires some math using both the year and month properties, so this is a convenience function for getting the difference in months.
    Note that the number of days in the months or how far into the month either date is is irrelevant. It is the difference in the month property combined with the difference in years * 12. So, for instance, December 31st and January 1st are one month apart just as December 1st and January 31st are one month apart.
    Parameters:

    SysTime `rhs` | The SysTime to subtract from this one.

    Examples:

        assert(SysTime(Date(1999, 2, 1)).diffMonths(
                    SysTime(Date(1999, 1, 31))) == 1);

        assert(SysTime(Date(1999, 1, 31)).diffMonths(
                    SysTime(Date(1999, 2, 1))) == -1);

        assert(SysTime(Date(1999, 3, 1)).diffMonths(
                    SysTime(Date(1999, 1, 1))) == 2);

        assert(SysTime(Date(1999, 1, 1)).diffMonths(
                    SysTime(Date(1999, 3, 31))) == -2);

  const nothrow @property @safe bool `isLeapYear`();
    Whether this SysTime is in a leap year.
  const nothrow @property @safe DayOfWeek `dayOfWeek`();
    Day of the week this SysTime is on.
  const nothrow @property @safe ushort `dayOfYear`();
    Day of the year this SysTime is on.
    Examples:

        assert(SysTime(DateTime(1999, 1, 1, 12, 22, 7)).dayOfYear == 1);
        assert(SysTime(DateTime(1999, 12, 31, 7, 2, 59)).dayOfYear == 365);
        assert(SysTime(DateTime(2000, 12, 31, 21, 20, 0)).dayOfYear == 366);

  @property @safe void `dayOfYear`(int `day`);
    Day of the year.
    Parameters:

    int `day` | The `day` of the year to set which `day` of the year this SysTime is on.

  const nothrow @property @safe int `dayOfGregorianCal`();
    The Xth day of the Gregorian Calendar that this SysTime is on.
    Examples:

        assert(SysTime(DateTime(1, 1, 1, 0, 0, 0)).dayOfGregorianCal == 1);
        assert(SysTime(DateTime(1, 12, 31, 23, 59, 59)).dayOfGregorianCal == 365);
        assert(SysTime(DateTime(2, 1, 1, 2, 2, 2)).dayOfGregorianCal == 366);

        assert(SysTime(DateTime(0, 12, 31, 7, 7, 7)).dayOfGregorianCal == 0);
        assert(SysTime(DateTime(0, 1, 1, 19, 30, 0)).dayOfGregorianCal == -365);
        assert(SysTime(DateTime(-1, 12, 31, 4, 7, 0)).dayOfGregorianCal == -366);

        assert(SysTime(DateTime(2000, 1, 1, 9, 30, 20)).dayOfGregorianCal == 730_120);
        assert(SysTime(DateTime(2010, 12, 31, 15, 45, 50)).dayOfGregorianCal == 734_137);

  nothrow @property @safe void `dayOfGregorianCal`(int `days`);
    The Xth day of the Gregorian Calendar that this SysTime is on. Setting this property does not affect the time portion of SysTime.
    Parameters:

    int `days` | The day of the Gregorian Calendar to set this SysTime to.

    Examples:

        auto st = SysTime(DateTime(0, 1, 1, 12, 0, 0));
        st.dayOfGregorianCal = 1;
        assert(st == SysTime(DateTime(1, 1, 1, 12, 0, 0)));

        st.dayOfGregorianCal = 365;
        assert(st == SysTime(DateTime(1, 12, 31, 12, 0, 0)));

        st.dayOfGregorianCal = 366;
        assert(st == SysTime(DateTime(2, 1, 1, 12, 0, 0)));

        st.dayOfGregorianCal = 0;
        assert(st == SysTime(DateTime(0, 12, 31, 12, 0, 0)));

        st.dayOfGregorianCal = -365;
        assert(st == SysTime(DateTime(-0, 1, 1, 12, 0, 0)));

        st.dayOfGregorianCal = -366;
        assert(st == SysTime(DateTime(-1, 12, 31, 12, 0, 0)));

        st.dayOfGregorianCal = 730_120;
        assert(st == SysTime(DateTime(2000, 1, 1, 12, 0, 0)));

        st.dayOfGregorianCal = 734_137;
        assert(st == SysTime(DateTime(2010, 12, 31, 12, 0, 0)));

  const nothrow @property @safe ubyte `isoWeek`();
    The ISO 8601 week of the year that this SysTime is in.
    See Also:
    ISO Week Date.
  const nothrow @property @safe SysTime `endOfMonth`();
    SysTime for the last day in the month that this Date is in. The time portion of `endOfMonth` is always 23:59:59.9999999.
    Examples:

        assert(SysTime(DateTime(1999, 1, 6, 0, 0, 0)).endOfMonth ==
               SysTime(DateTime(1999, 1, 31, 23, 59, 59),
                       hnsecs(9_999_999)));

        assert(SysTime(DateTime(1999, 2, 7, 19, 30, 0),
                       msecs(24)).endOfMonth ==
               SysTime(DateTime(1999, 2, 28, 23, 59, 59),
                       hnsecs(9_999_999)));

        assert(SysTime(DateTime(2000, 2, 7, 5, 12, 27),
                       usecs(5203)).endOfMonth ==
               SysTime(DateTime(2000, 2, 29, 23, 59, 59),
                       hnsecs(9_999_999)));

        assert(SysTime(DateTime(2000, 6, 4, 12, 22, 9),
                       hnsecs(12345)).endOfMonth ==
               SysTime(DateTime(2000, 6, 30, 23, 59, 59),
                       hnsecs(9_999_999)));

  const nothrow @property @safe ubyte `daysInMonth`();
    The last day in the month that this SysTime is in.
    Examples:

        assert(SysTime(DateTime(1999, 1, 6, 0, 0, 0)).daysInMonth == 31);
        assert(SysTime(DateTime(1999, 2, 7, 19, 30, 0)).daysInMonth == 28);
        assert(SysTime(DateTime(2000, 2, 7, 5, 12, 27)).daysInMonth == 29);
        assert(SysTime(DateTime(2000, 6, 4, 12, 22, 9)).daysInMonth == 30);

  const nothrow @property @safe bool `isAD`();
    Whether the current year is a date in A.D.
    Examples:

        assert(SysTime(DateTime(1, 1, 1, 12, 7, 0)).isAD);
        assert(SysTime(DateTime(2010, 12, 31, 0, 0, 0)).isAD);
        assert(!SysTime(DateTime(0, 12, 31, 23, 59, 59)).isAD);
        assert(!SysTime(DateTime(-2010, 1, 1, 2, 2, 2)).isAD);

  const nothrow @property @safe long `julianDay`();
    The Julian day for this SysTime at the given time. For example, prior to noon, 1996-03-31 would be the Julian day number 2_450_173, so this function returns 2_450_173, while from noon onward, the Julian day number would be 2_450_174, so this function returns 2_450_174.
  const nothrow @property @safe long `modJulianDay`();
    The modified Julian day for any time on this date (since, the modified Julian day changes at midnight).
  const nothrow @safe Date `opCast`(T)()
  if (is(Unqual!T == Date));
    Returns a Date equivalent to this SysTime.
  const nothrow @safe DateTime `opCast`(T)()
  if (is(Unqual!T == DateTime));
    Returns a DateTime equivalent to this SysTime.
  const nothrow @safe TimeOfDay `opCast`(T)()
  if (is(Unqual!T == TimeOfDay));
    Returns a TimeOfDay equivalent to this SysTime.
  const nothrow @safe string `toISOString`();
    Converts this SysTime to a string with the format YYYYMMDDTHHMMSS.FFFFFFFTZ (where F is fractional seconds and TZ is time zone).
    Note that the number of digits in the fractional seconds varies with the number of fractional seconds. It's a maximum of 7 (which would be hnsecs), but only has as many as are necessary to hold the correct value (so no trailing zeroes), and if there are no fractional seconds, then there is no decimal point.
    If this SysTime's time zone is LocalTime, then TZ is empty. If its time zone is UTC, then it is "Z". Otherwise, it is the offset from UTC (e.g. +0100 or -0700). Note that the offset from UTC is not enough to uniquely identify the time zone.
    Time zone offsets will be in the form +HHMM or -HHMM.
    Warning: Previously, `toISOString` did the same as toISOExtString and generated +HH:MM or -HH:MM for the time zone when it was not LocalTime or UTC, which is not in conformance with ISO 9601 for the non-extended string format. This has now been fixed. However, for now, fromISOString will continue to accept the extended format for the time zone so that any code which has been writing out the result of `toISOString` to read in later will continue to work.
    Examples:

        assert(SysTime(DateTime(2010, 7, 4, 7, 6, 12)).toISOString() ==
               "20100704T070612");

        assert(SysTime(DateTime(1998, 12, 25, 2, 15, 0),
                       msecs(24)).toISOString() ==
               "19981225T021500.024");

        assert(SysTime(DateTime(0, 1, 5, 23, 9, 59)).toISOString() ==
               "00000105T230959");

        assert(SysTime(DateTime(-4, 1, 5, 0, 0, 2),
                       hnsecs(520_920)).toISOString() ==
               "-00040105T000002.052092");

  const nothrow @safe string `toISOExtString`();
    Converts this SysTime to a string with the format YYYY-MM-DDTHH:MM:SS.FFFFFFFTZ (where F is fractional seconds and TZ is the time zone).
    Note that the number of digits in the fractional seconds varies with the number of fractional seconds. It's a maximum of 7 (which would be hnsecs), but only has as many as are necessary to hold the correct value (so no trailing zeroes), and if there are no fractional seconds, then there is no decimal point.
    If this SysTime's time zone is LocalTime, then TZ is empty. If its time zone is UTC, then it is "Z". Otherwise, it is the offset from UTC (e.g. +01:00 or -07:00). Note that the offset from UTC is not enough to uniquely identify the time zone.
    Time zone offsets will be in the form +HH:MM or -HH:MM.
    Examples:

        assert(SysTime(DateTime(2010, 7, 4, 7, 6, 12)).toISOExtString() ==
               "2010-07-04T07:06:12");

        assert(SysTime(DateTime(1998, 12, 25, 2, 15, 0),
                       msecs(24)).toISOExtString() ==
               "1998-12-25T02:15:00.024");

        assert(SysTime(DateTime(0, 1, 5, 23, 9, 59)).toISOExtString() ==
               "0000-01-05T23:09:59");

        assert(SysTime(DateTime(-4, 1, 5, 0, 0, 2),
                       hnsecs(520_920)).toISOExtString() ==
               "-0004-01-05T00:00:02.052092");

  const nothrow @safe string `toSimpleString`();
    Converts this SysTime to a string with the format YYYY-Mon-DD HH:MM:SS.FFFFFFFTZ (where F is fractional seconds and TZ is the time zone).
    Note that the number of digits in the fractional seconds varies with the number of fractional seconds. It's a maximum of 7 (which would be hnsecs), but only has as many as are necessary to hold the correct value (so no trailing zeroes), and if there are no fractional seconds, then there is no decimal point.
    If this SysTime's time zone is LocalTime, then TZ is empty. If its time zone is UTC, then it is "Z". Otherwise, it is the offset from UTC (e.g. +01:00 or -07:00). Note that the offset from UTC is not enough to uniquely identify the time zone.
    Time zone offsets will be in the form +HH:MM or -HH:MM.
    Examples:

        assert(SysTime(DateTime(2010, 7, 4, 7, 6, 12)).toSimpleString() ==
               "2010-Jul-04 07:06:12");

        assert(SysTime(DateTime(1998, 12, 25, 2, 15, 0),
                       msecs(24)).toSimpleString() ==
               "1998-Dec-25 02:15:00.024");

        assert(SysTime(DateTime(0, 1, 5, 23, 9, 59)).toSimpleString() ==
               "0000-Jan-05 23:09:59");

        assert(SysTime(DateTime(-4, 1, 5, 0, 0, 2),
                       hnsecs(520_920)).toSimpleString() ==
                "-0004-Jan-05 00:00:02.052092");

  const nothrow @safe string `toString`();
    Converts this SysTime to a string.
  @safe SysTime `fromISOString`(S)(in S `isoString`, immutable TimeZone `tz` = null)
  if (isSomeString!S);
    Creates a SysTime from a string with the format YYYYMMDDTHHMMSS.FFFFFFFTZ (where F is fractional seconds is the time zone). Whitespace is stripped from the given string.
    The exact format is exactly as described in toISOString except that trailing zeroes are permitted - including having fractional seconds with all zeroes. However, a decimal point with nothing following it is invalid.
    If there is no time zone in the string, then LocalTime is used. If the time zone is "Z", then UTC is used. Otherwise, a SimpleTimeZone which corresponds to the given offset from UTC is used. To get the returned SysTime to be a particular time zone, pass in that time zone and the SysTime to be returned will be converted to that time zone (though it will still be read in as whatever time zone is in its string).
    The accepted formats for time zone offsets are +HH, -HH, +HHMM, and -HHMM.
    Warning: Previously, toISOString did the same as toISOExtString and generated +HH:MM or -HH:MM for the time zone when it was not LocalTime or UTC, which is not in conformance with ISO 9601 for the non-extended string format. This has now been fixed. However, for now, `fromISOString` will continue to accept the extended format for the time zone so that any code which has been writing out the result of toISOString to read in later will continue to work.
    Parameters:

    S `isoString` | A string formatted in the ISO format for dates and times.
    TimeZone `tz` | The time zone to convert the given time to (no conversion occurs if `null`).

    Throws:
    DateTimeException if the given string is not in the ISO format or if the resulting SysTime would not be valid.
  @safe SysTime `fromISOExtString`(S)(in S `isoExtString`, immutable TimeZone `tz` = null)
  if (isSomeString!S);
    Creates a SysTime from a string with the format YYYY-MM-DDTHH:MM:SS.FFFFFFFTZ (where F is fractional seconds is the time zone). Whitespace is stripped from the given string.
    The exact format is exactly as described in toISOExtString except that trailing zeroes are permitted - including having fractional seconds with all zeroes. However, a decimal point with nothing following it is invalid.
    If there is no time zone in the string, then LocalTime is used. If the time zone is "Z", then UTC is used. Otherwise, a SimpleTimeZone which corresponds to the given offset from UTC is used. To get the returned SysTime to be a particular time zone, pass in that time zone and the SysTime to be returned will be converted to that time zone (though it will still be read in as whatever time zone is in its string).
    The accepted formats for time zone offsets are +HH, -HH, +HH:MM, and

    HH: MM.

    Parameters:

    S `isoExtString` | A string formatted in the ISO Extended format for dates and times.
    TimeZone `tz` | The time zone to convert the given time to (no conversion occurs if `null`).

    Throws:
    DateTimeException if the given string is not in the ISO format or if the resulting SysTime would not be valid.
  @safe SysTime `fromSimpleString`(S)(in S `simpleString`, immutable TimeZone `tz` = null)
  if (isSomeString!S);
    Creates a SysTime from a string with the format YYYY-MM-DD HH:MM:SS.FFFFFFFTZ (where F is fractional seconds is the time zone). Whitespace is stripped from the given string.
    The exact format is exactly as described in toSimpleString except that trailing zeroes are permitted - including having fractional seconds with all zeroes. However, a decimal point with nothing following it is invalid.
    If there is no time zone in the string, then LocalTime is used. If the time zone is "Z", then UTC is used. Otherwise, a SimpleTimeZone which corresponds to the given offset from UTC is used. To get the returned SysTime to be a particular time zone, pass in that time zone and the SysTime to be returned will be converted to that time zone (though it will still be read in as whatever time zone is in its string).
    The accepted formats for time zone offsets are +HH, -HH, +HH:MM, and

    HH: MM.

    Parameters:

    S `simpleString` | A string formatted in the way that toSimpleString formats dates and times.
    TimeZone `tz` | The time zone to convert the given time to (no conversion occurs if `null`).

    Throws:
    DateTimeException if the given string is not in the ISO format or if the resulting SysTime would not be valid.
  static pure nothrow @property @safe SysTime `min`();
    Returns the SysTime farthest in the past which is representable by SysTime.
    The SysTime which is returned is in UTC.
  static pure nothrow @property @safe SysTime `max`();
    Returns the SysTime farthest in the future which is representable by SysTime.
    The SysTime which is returned is in UTC.
struct `Date`;
  Represents a date in the Proleptic Gregorian Calendar ranging from 32,768 B.C. to 32,767 A.D. Positive years are A.D. Non-positive years are B.C.
  Year, month, and day are kept separately internally so that `Date` is optimized for calendar-based operations.
  `Date` uses the Proleptic Gregorian Calendar, so it assumes the Gregorian leap year calculations for its entire length. As per ISO 8601, it treats 1 B.C. as year 0, i.e. 1 B.C. is 0, 2 B.C. is -1, etc. Use yearBC to use B.C. as a positive integer with 1 B.C. being the year prior to 1 A.D.
  Year 0 is a leap year.
  pure @safe this(int `year`, int `month`, int `day`);
    Throws:
    DateTimeException if the resulting Date would not be valid.
    Parameters:

    int `year` | Year of the Gregorian Calendar. Positive values are A.D. Non-positive values are B.C. with `year` 0 being the `year` prior to 1 A.D.
    int `month` | Month of the `year`.
    int `day` | Day of the `month`.

  pure nothrow @safe this(int `day`);
    Parameters:

    int `day` | The Xth `day` of the Gregorian Calendar that the constructed Date will be for.

  const pure nothrow @safe int `opCmp`(in Date `rhs`);
    Compares this Date with the given Date.
    Returns:

    this < `rhs` | < 0
    this == `rhs` | 0
    this > `rhs` | > 0

  const pure nothrow @property @safe short `year`();
    Year of the Gregorian Calendar. Positive numbers are A.D. Non-positive are B.C.
    Examples:

        assert(Date(1999, 7, 6).year == 1999);
        assert(Date(2010, 10, 4).year == 2010);
        assert(Date(-7, 4, 5).year == -7);

  pure @property @safe void `year`(int `year`);
    Year of the Gregorian Calendar. Positive numbers are A.D. Non-positive are B.C.
    Parameters:

    int `year` | The `year` to set this Date's `year` to.

    Throws:
    DateTimeException if the new `year` is not a leap `year` and the resulting date would be on February 29th.
    Examples:

        assert(Date(1999, 7, 6).year == 1999);
        assert(Date(2010, 10, 4).year == 2010);
        assert(Date(-7, 4, 5).year == -7);

  const pure @property @safe ushort `yearBC`();
    Year B.C. of the Gregorian Calendar counting year 0 as 1 B.C.
    Throws:
    DateTimeException if isAD is `true`.
    Examples:

        assert(Date(0, 1, 1).yearBC == 1);
        assert(Date(-1, 1, 1).yearBC == 2);
        assert(Date(-100, 1, 1).yearBC == 101);

  pure @property @safe void `yearBC`(int `year`);
    Year B.C. of the Gregorian Calendar counting `year` 0 as 1 B.C.
    Parameters:

    int `year` | The `year` B.C. to set this Date's `year` to.

    Throws:
    DateTimeException if a non-positive value is given.
    Examples:

        auto date = Date(2010, 1, 1);
        date.yearBC = 1;
        assert(date == Date(0, 1, 1));

        date.yearBC = 10;
        assert(date == Date(-9, 1, 1));

  const pure nothrow @property @safe Month `month`();
    Month of a Gregorian Year.
    Examples:

        assert(Date(1999, 7, 6).month == 7);
        assert(Date(2010, 10, 4).month == 10);
        assert(Date(-7, 4, 5).month == 4);

  pure @property @safe void `month`(Month `month`);
    Month of a Gregorian Year.
    Parameters:

    Month `month` | The `month` to set this Date's `month` to.

    Throws:
    DateTimeException if the given `month` is not a valid `month` or if the current day would not be valid in the given `month`.
  const pure nothrow @property @safe ubyte `day`();
    Day of a Gregorian Month.
    Examples:

        assert(Date(1999, 7, 6).day == 6);
        assert(Date(2010, 10, 4).day == 4);
        assert(Date(-7, 4, 5).day == 5);

  pure @property @safe void `day`(int `day`);
    Day of a Gregorian Month.
    Parameters:

    int `day` | The `day` of the month to set this Date's `day` to.

    Throws:
    DateTimeException if the given `day` is not a valid `day` of the current month.
  pure nothrow ref @safe Date `add`(string units)(long `value`, AllowDayOverflow `allowOverflow` = Yes.allowDayOverflow)
  if (units == "years");
    Adds the given number of years or months to this Date. A negative number will subtract.
    Note that if day overflow is allowed, and the date with the adjusted year/month overflows the number of days in the new month, then the month will be incremented by one, and the day set to the number of days overflowed. (e.g. if the day were 31 and the new month were June, then the month would be incremented to July, and the new day would be 1). If day overflow is not allowed, then the day will be set to the last valid day in the month (e.g. June 31st would become June 30th).
    Parameters:

    units | The type of units to `add` ("years" or "months").
    long `value` | The number of months or years to `add` to this Date.
    AllowDayOverflow `allowOverflow` | Whether the day should be allowed to overflow, causing the month to increment.

    Examples:

        import std.typecons : No;

        auto d1 = Date(2010, 1, 1);
        d1.add!"months"(11);
        assert(d1 == Date(2010, 12, 1));

        auto d2 = Date(2010, 1, 1);
        d2.add!"months"(-11);
        assert(d2 == Date(2009, 2, 1));

        auto d3 = Date(2000, 2, 29);
        d3.add!"years"(1);
        assert(d3 == Date(2001, 3, 1));

        auto d4 = Date(2000, 2, 29);
        d4.add!"years"(1, No.allowDayOverflow);
        assert(d4 == Date(2001, 2, 28));

  pure nothrow ref @safe Date `roll`(string units)(long `value`, AllowDayOverflow `allowOverflow` = Yes.allowDayOverflow)
  if (units == "years");
    Adds the given number of years or months to this Date. A negative number will subtract.
    The difference between rolling and adding is that rolling does not affect larger units. Rolling a Date 12 months gets the exact same Date. However, the days can still be affected due to the differing number of days in each month.
    Because there are no units larger than years, there is no difference between adding and rolling years.
    Parameters:

    units | The type of units to add ("years" or "months").
    long `value` | The number of months or years to add to this Date.
    AllowDayOverflow `allowOverflow` | Whether the day should be allowed to overflow, causing the month to increment.

    Examples:

        import std.typecons : No;

        auto d1 = Date(2010, 1, 1);
        d1.roll!"months"(1);
        assert(d1 == Date(2010, 2, 1));

        auto d2 = Date(2010, 1, 1);
        d2.roll!"months"(-1);
        assert(d2 == Date(2010, 12, 1));

        auto d3 = Date(1999, 1, 29);
        d3.roll!"months"(1);
        assert(d3 == Date(1999, 3, 1));

        auto d4 = Date(1999, 1, 29);
        d4.roll!"months"(1, No.allowDayOverflow);
        assert(d4 == Date(1999, 2, 28));

        auto d5 = Date(2000, 2, 29);
        d5.roll!"years"(1);
        assert(d5 == Date(2001, 3, 1));

        auto d6 = Date(2000, 2, 29);
        d6.roll!"years"(1, No.allowDayOverflow);
        assert(d6 == Date(2001, 2, 28));

  pure nothrow ref @safe Date `roll`(string units)(long `days`)
  if (units == "`days`");
    Adds the given number of units to this Date. A negative number will subtract.
    The difference between rolling and adding is that rolling does not affect larger units. For instance, rolling a Date one year's worth of `days` gets the exact same Date.
    The only accepted units are "`days`".
    Parameters:

    units | The units to add. Must be "`days`".
    long `days` | The number of `days` to add to this Date.

    Examples:

        auto d = Date(2010, 1, 1);
        d.roll!"days"(1);
        assert(d == Date(2010, 1, 2));
        d.roll!"days"(365);
        assert(d == Date(2010, 1, 26));
        d.roll!"days"(-32);
        assert(d == Date(2010, 1, 25));

  const pure nothrow @safe Date `opBinary`(string op)(Duration `duration`)
  if (op == "+" || op == "-");
    Gives the result of adding or subtracting a core.time.Duration from
    The legal types of arithmetic for Date using this operator are

    Date | + | Duration | --> | Date
    Date | - | Duration | --> | Date

    Parameters:

    Duration `duration` | The core.time.Duration to add to or subtract from this Date.

    Examples:

        assert(Date(2015, 12, 31) + days(1) == Date(2016, 1, 1));
        assert(Date(2004, 2, 26) + days(4) == Date(2004, 3, 1));

        assert(Date(2016, 1, 1) - days(1) == Date(2015, 12, 31));
        assert(Date(2004, 3, 1) - days(4) == Date(2004, 2, 26));

  const pure nothrow @safe Date `opBinary`(string op)(TickDuration `td`)
  if (op == "+" || op == "-");
    Deprecated. core.time.TickDuration is going to be deprecated in favor of core.time.MonoTime and core.time.Duration. Use Duration instead. This overload will be removed in January 2017.
    Defines + and - with core.time.TickDuration.
  pure nothrow ref @safe Date `opOpAssign`(string op)(Duration `duration`)
  if (op == "+" || op == "-");
    Gives the result of adding or subtracting a core.time.Duration from this Date, as well as assigning the result to this Date.
    The legal types of arithmetic for Date using this operator are

    Date | + | Duration | --> | Date
    Date | - | Duration | --> | Date

    Parameters:

    Duration `duration` | The core.time.Duration to add to or subtract from this Date.

  pure nothrow ref @safe Date `opOpAssign`(string op)(TickDuration `td`)
  if (op == "+" || op == "-");
    Deprecated. core.time.TickDuration is going to be deprecated in favor of core.time.MonoTime and core.time.Duration. Use Duration instead. This overload will be removed in January 2017.
    Defines += and -= with core.time.TickDuration.
  const pure nothrow @safe Duration `opBinary`(string op)(in Date `rhs`)
  if (op == "-");
    Gives the difference between two Dates.
    The legal types of arithmetic for Date using this operator are

    Date | - | Date | --> | duration

  const pure nothrow @safe int `diffMonths`(in Date `rhs`);
    Returns the difference between the two Dates in months.
    To get the difference in years, subtract the year property of two SysTimes. To get the difference in days or weeks, subtract the SysTimes themselves and use the core.time.Duration that results. Because converting between months and smaller units requires a specific date (which core.time.Durations don't have), getting the difference in months requires some math using both the year and month properties, so this is a convenience function for getting the difference in months.
    Note that the number of days in the months or how far into the month either Date is is irrelevant. It is the difference in the month property combined with the difference in years * 12. So, for instance, December 31st and January 1st are one month apart just as December 1st and January 31st are one month apart.
    Parameters:

    Date `rhs` | The Date to subtract from this one.

    Examples:

        assert(Date(1999, 2, 1).diffMonths(Date(1999, 1, 31)) == 1);
        assert(Date(1999, 1, 31).diffMonths(Date(1999, 2, 1)) == -1);
        assert(Date(1999, 3, 1).diffMonths(Date(1999, 1, 1)) == 2);
        assert(Date(1999, 1, 1).diffMonths(Date(1999, 3, 31)) == -2);

  const pure nothrow @property @safe bool `isLeapYear`();
    Whether this Date is in a leap year.
  const pure nothrow @property @safe DayOfWeek `dayOfWeek`();
    Day of the week this Date is on.
  const pure nothrow @property @safe ushort `dayOfYear`();
    Day of the year this Date is on.
    Examples:

        assert(Date(1999, 1, 1).dayOfYear == 1);
        assert(Date(1999, 12, 31).dayOfYear == 365);
        assert(Date(2000, 12, 31).dayOfYear == 366);

  pure @property @safe void `dayOfYear`(int `day`);
    Day of the year.
    Parameters:

    int `day` | The `day` of the year to set which `day` of the year this Date is on.

    Throws:
    DateTimeException if the given `day` is an invalid `day` of the year.
  const pure nothrow @property @safe int `dayOfGregorianCal`();
    The Xth day of the Gregorian Calendar that this Date is on.
    Examples:

        assert(Date(1, 1, 1).dayOfGregorianCal == 1);
        assert(Date(1, 12, 31).dayOfGregorianCal == 365);
        assert(Date(2, 1, 1).dayOfGregorianCal == 366);

        assert(Date(0, 12, 31).dayOfGregorianCal == 0);
        assert(Date(0, 1, 1).dayOfGregorianCal == -365);
        assert(Date(-1, 12, 31).dayOfGregorianCal == -366);

        assert(Date(2000, 1, 1).dayOfGregorianCal == 730_120);
        assert(Date(2010, 12, 31).dayOfGregorianCal == 734_137);

  pure nothrow @property @safe void `dayOfGregorianCal`(int `day`);
    The Xth `day` of the Gregorian Calendar that this Date is on.
    Parameters:

    int `day` | The `day` of the Gregorian Calendar to set this Date to.

    Examples:

        auto date = Date.init;
        date.dayOfGregorianCal = 1;
        assert(date == Date(1, 1, 1));

        date.dayOfGregorianCal = 365;
        assert(date == Date(1, 12, 31));

        date.dayOfGregorianCal = 366;
        assert(date == Date(2, 1, 1));

        date.dayOfGregorianCal = 0;
        assert(date == Date(0, 12, 31));

        date.dayOfGregorianCal = -365;
        assert(date == Date(-0, 1, 1));

        date.dayOfGregorianCal = -366;
        assert(date == Date(-1, 12, 31));

        date.dayOfGregorianCal = 730_120;
        assert(date == Date(2000, 1, 1));

        date.dayOfGregorianCal = 734_137;
        assert(date == Date(2010, 12, 31));

  const pure nothrow @property @safe ubyte `isoWeek`();
    The ISO 8601 week of the year that this Date is in.
    See Also:
    ISO Week Date
  const pure nothrow @property @safe Date `endOfMonth`();
    Date for the last day in the month that this Date is in.
    Examples:

        assert(Date(1999, 1, 6).endOfMonth == Date(1999, 1, 31));
        assert(Date(1999, 2, 7).endOfMonth == Date(1999, 2, 28));
        assert(Date(2000, 2, 7).endOfMonth == Date(2000, 2, 29));
        assert(Date(2000, 6, 4).endOfMonth == Date(2000, 6, 30));

  const pure nothrow @property @safe ubyte `daysInMonth`();
    The last day in the month that this Date is in.
    Examples:

        assert(Date(1999, 1, 6).daysInMonth == 31);
        assert(Date(1999, 2, 7).daysInMonth == 28);
        assert(Date(2000, 2, 7).daysInMonth == 29);
        assert(Date(2000, 6, 4).daysInMonth == 30);

  const pure nothrow @property @safe bool `isAD`();
    Whether the current year is a date in A.D.
    Examples:

        assert(Date(1, 1, 1).isAD);
        assert(Date(2010, 12, 31).isAD);
        assert(!Date(0, 12, 31).isAD);
        assert(!Date(-2010, 1, 1).isAD);

  const pure nothrow @property @safe long `julianDay`();
    The Julian day for this Date at noon (since the Julian day changes at noon).
  const pure nothrow @property @safe long `modJulianDay`();
    The modified Julian day for any time on this date (since, the modified Julian day changes at midnight).
  const pure nothrow @safe string `toISOString`();
    Converts this Date to a string with the format YYYYMMDD.
    Examples:

        assert(Date(2010, 7, 4).toISOString() == "20100704");
        assert(Date(1998, 12, 25).toISOString() == "19981225");
        assert(Date(0, 1, 5).toISOString() == "00000105");
        assert(Date(-4, 1, 5).toISOString() == "-00040105");

  const pure nothrow @safe string `toISOExtString`();
    Converts this Date to a string with the format YYYY-MM-DD.
    Examples:

        assert(Date(2010, 7, 4).toISOExtString() == "2010-07-04");
        assert(Date(1998, 12, 25).toISOExtString() == "1998-12-25");
        assert(Date(0, 1, 5).toISOExtString() == "0000-01-05");
        assert(Date(-4, 1, 5).toISOExtString() == "-0004-01-05");

  const pure nothrow @safe string `toSimpleString`();
    Converts this Date to a string with the format YYYY-Mon-DD.
    Examples:

        assert(Date(2010, 7, 4).toSimpleString() == "2010-Jul-04");
        assert(Date(1998, 12, 25).toSimpleString() == "1998-Dec-25");
        assert(Date(0, 1, 5).toSimpleString() == "0000-Jan-05");
        assert(Date(-4, 1, 5).toSimpleString() == "-0004-Jan-05");

  const pure nothrow @safe string `toString`();
    Converts this Date to a string.
  pure @safe Date `fromISOString`(S)(in S `isoString`)
  if (isSomeString!S);
    Creates a Date from a string with the format YYYYMMDD. Whitespace is stripped from the given string.
    Parameters:

    S `isoString` | A string formatted in the ISO format for dates.

    Throws:
    DateTimeException if the given string is not in the ISO format or if the resulting Date would not be valid.
  pure @safe Date `fromISOExtString`(S)(in S `isoExtString`)
  if (isSomeString!S);
    Creates a Date from a string with the format YYYY-MM-DD. Whitespace is stripped from the given string.
    Parameters:

    S `isoExtString` | A string formatted in the ISO Extended format for dates.

    Throws:
    DateTimeException if the given string is not in the ISO Extended format or if the resulting Date would not be valid.
  pure @safe Date `fromSimpleString`(S)(in S `simpleString`)
  if (isSomeString!S);
    Creates a Date from a string with the format YYYY-Mon-DD. Whitespace is stripped from the given string.
    Parameters:

    S `simpleString` | A string formatted in the way that toSimpleString formats dates.

    Throws:
    DateTimeException if the given string is not in the correct format or if the resulting Date would not be valid.
  static pure nothrow @property @safe Date `min`();
    Returns the Date farthest in the past which is representable by Date.
  static pure nothrow @property @safe Date `max`();
    Returns the Date farthest in the future which is representable by Date.
struct `TimeOfDay`;
  Represents a time of day with hours, minutes, and seconds. It uses 24 hour time.
  pure @safe this(int `hour`, int `minute`, int `second` = 0);
    Parameters:

    int `hour` | Hour of the day [0 - 24).
    int `minute` | Minute of the `hour` [0 - 60).
    int `second` | Second of the `minute` [0 - 60).

    Throws:
    DateTimeException if the resulting TimeOfDay would be not be valid.
  const pure nothrow @safe int `opCmp`(in TimeOfDay `rhs`);
    Compares this TimeOfDay with the given TimeOfDay.
    Returns:

    this < `rhs` | < 0
    this == `rhs` | 0
    this > `rhs` | > 0

  const pure nothrow @property @safe ubyte `hour`();
    Hours past midnight.
  pure @property @safe void `hour`(int `hour`);
    Hours past midnight.
    Parameters:

    int `hour` | The `hour` of the day to set this TimeOfDay's `hour` to.

    Throws:
    DateTimeException if the given `hour` would result in an invalid TimeOfDay.
  const pure nothrow @property @safe ubyte `minute`();
    Minutes past the hour.
  pure @property @safe void `minute`(int `minute`);
    Minutes past the hour.
    Parameters:

    int `minute` | The `minute` to set this TimeOfDay's `minute` to.

    Throws:
    DateTimeException if the given `minute` would result in an invalid TimeOfDay.
  const pure nothrow @property @safe ubyte `second`();
    Seconds past the minute.
  pure @property @safe void `second`(int `second`);
    Seconds past the minute.
    Parameters:

    int `second` | The `second` to set this TimeOfDay's `second` to.

    Throws:
    DateTimeException if the given `second` would result in an invalid TimeOfDay.
  pure nothrow ref @safe TimeOfDay `roll`(string units)(long `value`)
  if (units == "hours");
    Adds the given number of units to this TimeOfDay. A negative number will subtract.
    The difference between rolling and adding is that rolling does not affect larger units. For instance, rolling a TimeOfDay one hours's worth of minutes gets the exact same TimeOfDay.
    Accepted units are "hours", "minutes", and "seconds".
    Parameters:

    units | The units to add.
    long `value` | The number of units to add to this TimeOfDay.

    Examples:

        auto tod1 = TimeOfDay(7, 12, 0);
        tod1.roll!"hours"(1);
        assert(tod1 == TimeOfDay(8, 12, 0));

        auto tod2 = TimeOfDay(7, 12, 0);
        tod2.roll!"hours"(-1);
        assert(tod2 == TimeOfDay(6, 12, 0));

        auto tod3 = TimeOfDay(23, 59, 0);
        tod3.roll!"minutes"(1);
        assert(tod3 == TimeOfDay(23, 0, 0));

        auto tod4 = TimeOfDay(0, 0, 0);
        tod4.roll!"minutes"(-1);
        assert(tod4 == TimeOfDay(0, 59, 0));

        auto tod5 = TimeOfDay(23, 59, 59);
        tod5.roll!"seconds"(1);
        assert(tod5 == TimeOfDay(23, 59, 0));

        auto tod6 = TimeOfDay(0, 0, 0);
        tod6.roll!"seconds"(-1);
        assert(tod6 == TimeOfDay(0, 0, 59));

  const pure nothrow @safe TimeOfDay `opBinary`(string op)(Duration `duration`)
  if (op == "+" || op == "-");
    Gives the result of adding or subtracting a core.time.Duration from this TimeOfDay.
    The legal types of arithmetic for TimeOfDay using this operator are

    TimeOfDay | + | Duration | --> | TimeOfDay
    TimeOfDay | - | Duration | --> | TimeOfDay

    Parameters:

    Duration `duration` | The core.time.Duration to add to or subtract from this TimeOfDay.

    Examples:

        assert(TimeOfDay(12, 12, 12) + seconds(1) == TimeOfDay(12, 12, 13));
        assert(TimeOfDay(12, 12, 12) + minutes(1) == TimeOfDay(12, 13, 12));
        assert(TimeOfDay(12, 12, 12) + hours(1) == TimeOfDay(13, 12, 12));
        assert(TimeOfDay(23, 59, 59) + seconds(1) == TimeOfDay(0, 0, 0));

        assert(TimeOfDay(12, 12, 12) - seconds(1) == TimeOfDay(12, 12, 11));
        assert(TimeOfDay(12, 12, 12) - minutes(1) == TimeOfDay(12, 11, 12));
        assert(TimeOfDay(12, 12, 12) - hours(1) == TimeOfDay(11, 12, 12));
        assert(TimeOfDay(0, 0, 0) - seconds(1) == TimeOfDay(23, 59, 59));

  const pure nothrow @safe TimeOfDay `opBinary`(string op)(TickDuration `td`)
  if (op == "+" || op == "-");
    Deprecated. core.time.TickDuration is going to be deprecated in favor of core.time.MonoTime and core.time.Duration. Use Duration instead. This overload will be removed in January 2017.
    Defines + and - with core.time.TickDuration.
  pure nothrow ref @safe TimeOfDay `opOpAssign`(string op)(Duration `duration`)
  if (op == "+" || op == "-");
    Gives the result of adding or subtracting a core.time.Duration from this TimeOfDay, as well as assigning the result to this TimeOfDay.
    The legal types of arithmetic for TimeOfDay using this operator are

    TimeOfDay | + | Duration | --> | TimeOfDay
    TimeOfDay | - | Duration | --> | TimeOfDay

    Parameters:

    Duration `duration` | The core.time.Duration to add to or subtract from this TimeOfDay.

  pure nothrow ref @safe TimeOfDay `opOpAssign`(string op)(TickDuration `td`)
  if (op == "+" || op == "-");
    Deprecated. core.time.TickDuration is going to be deprecated in favor of core.time.MonoTime and core.time.Duration. Use Duration instead. This overload will be removed in January 2017.
    Defines += and -= with core.time.TickDuration.
  const pure nothrow @safe Duration `opBinary`(string op)(in TimeOfDay `rhs`)
  if (op == "-");
    Gives the difference between two TimeOfDays.
    The legal types of arithmetic for TimeOfDay using this operator are

    TimeOfDay | - | TimeOfDay | --> | duration

    Parameters:

    TimeOfDay `rhs` | The TimeOfDay to subtract from this one.

  const pure nothrow @safe string `toISOString`();
    Converts this TimeOfDay to a string with the format HHMMSS.
    Examples:

        assert(TimeOfDay(0, 0, 0).toISOString() == "000000");
        assert(TimeOfDay(12, 30, 33).toISOString() == "123033");

  const pure nothrow @safe string `toISOExtString`();
    Converts this TimeOfDay to a string with the format HH:MM:SS.
    Examples:

        assert(TimeOfDay(0, 0, 0).toISOExtString() == "00:00:00");
        assert(TimeOfDay(12, 30, 33).toISOExtString() == "12:30:33");

  const pure nothrow @safe string `toString`();
    Converts this TimeOfDay to a string.
  pure @safe TimeOfDay `fromISOString`(S)(in S `isoString`)
  if (isSomeString!S);
    Creates a TimeOfDay from a string with the format HHMMSS. Whitespace is stripped from the given string.
    Parameters:

    S `isoString` | A string formatted in the ISO format for times.

    Throws:
    DateTimeException if the given string is not in the ISO format or if the resulting TimeOfDay would not be valid.
  pure @safe TimeOfDay `fromISOExtString`(S)(in S `isoExtString`)
  if (isSomeString!S);
    Creates a TimeOfDay from a string with the format HH:MM:SS. Whitespace is stripped from the given string.
    Parameters:

    S `isoExtString` | A string formatted in the ISO Extended format for times.

    Throws:
    DateTimeException if the given string is not in the ISO Extended format or if the resulting TimeOfDay would not be valid.
  static pure nothrow @property @safe TimeOfDay `min`();
    Returns midnight.
  static pure nothrow @property @safe TimeOfDay `max`();
    Returns one second short of midnight.
struct `DateTime`;
  Combines the Date and TimeOfDay structs to give an object which holds both the date and the time. It is optimized for calendar-based operations and has no concept of time zone. For an object which is optimized for time operations based on the system time, use SysTime. SysTime has a concept of time zone and has much higher precision (hnsecs). `DateTime` is intended primarily for calendar-based uses rather than precise time operations.
  pure nothrow @safe this(in Date `date`, in TimeOfDay `tod` = TimeOfDay.init);
    Parameters:

    Date `date` | The `date` portion of DateTime.
    TimeOfDay `tod` | The time portion of DateTime.

  pure @safe this(int `year`, int `month`, int `day`, int `hour` = 0, int `minute` = 0, int `second` = 0);
    Parameters:

    int `year` | The `year` portion of the date.
    int `month` | The `month` portion of the date.
    int `day` | The `day` portion of the date.
    int `hour` | The `hour` portion of the time;
    int `minute` | The `minute` portion of the time;
    int `second` | The `second` portion of the time;

  const pure nothrow @safe int `opCmp`(in DateTime `rhs`);
    Compares this DateTime with the given DateTime..
    Returns:

    this < `rhs` | < 0
    this == `rhs` | 0
    this > `rhs` | > 0

  const pure nothrow @property @safe Date `date`();
    The `date` portion of DateTime.
  pure nothrow @property @safe void `date`(in Date `date`);
    The `date` portion of DateTime.
    Parameters:

    Date `date` | The Date to set this DateTime's `date` portion to.

  const pure nothrow @property @safe TimeOfDay `timeOfDay`();
    The time portion of DateTime.
  pure nothrow @property @safe void `timeOfDay`(in TimeOfDay `tod`);
    The time portion of DateTime.
    Parameters:

    TimeOfDay `tod` | The TimeOfDay to set this DateTime's time portion to.

  const pure nothrow @property @safe short `year`();
    Year of the Gregorian Calendar. Positive numbers are A.D. Non-positive are B.C.
  pure @property @safe void `year`(int `year`);
    Year of the Gregorian Calendar. Positive numbers are A.D. Non-positive are B.C.
    Parameters:

    int `year` | The `year` to set this DateTime's `year` to.

    Throws:
    DateTimeException if the new `year` is not a leap `year` and if the resulting date would be on February 29th.
    Examples:

        assert(DateTime(Date(1999, 7, 6), TimeOfDay(9, 7, 5)).year == 1999);
        assert(DateTime(Date(2010, 10, 4), TimeOfDay(0, 0, 30)).year == 2010);
        assert(DateTime(Date(-7, 4, 5), TimeOfDay(7, 45, 2)).year == -7);

  const pure @property @safe short `yearBC`();
    Year B.C. of the Gregorian Calendar counting year 0 as 1 B.C.
    Throws:
    DateTimeException if isAD is `true`.
    Examples:

        assert(DateTime(Date(0, 1, 1), TimeOfDay(12, 30, 33)).yearBC == 1);
        assert(DateTime(Date(-1, 1, 1), TimeOfDay(10, 7, 2)).yearBC == 2);
        assert(DateTime(Date(-100, 1, 1), TimeOfDay(4, 59, 0)).yearBC == 101);

  pure @property @safe void `yearBC`(int `year`);
    Year B.C. of the Gregorian Calendar counting `year` 0 as 1 B.C.
    Parameters:

    int `year` | The `year` B.C. to set this DateTime's `year` to.

    Throws:
    DateTimeException if a non-positive value is given.
    Examples:

        auto dt = DateTime(Date(2010, 1, 1), TimeOfDay(7, 30, 0));
        dt.yearBC = 1;
        assert(dt == DateTime(Date(0, 1, 1), TimeOfDay(7, 30, 0)));

        dt.yearBC = 10;
        assert(dt == DateTime(Date(-9, 1, 1), TimeOfDay(7, 30, 0)));

  const pure nothrow @property @safe Month `month`();
    Month of a Gregorian Year.
    Examples:

        assert(DateTime(Date(1999, 7, 6), TimeOfDay(9, 7, 5)).month == 7);
        assert(DateTime(Date(2010, 10, 4), TimeOfDay(0, 0, 30)).month == 10);
        assert(DateTime(Date(-7, 4, 5), TimeOfDay(7, 45, 2)).month == 4);

  pure @property @safe void `month`(Month `month`);
    Month of a Gregorian Year.
    Parameters:

    Month `month` | The `month` to set this DateTime's `month` to.

    Throws:
    DateTimeException if the given `month` is not a valid `month`.
  const pure nothrow @property @safe ubyte `day`();
    Day of a Gregorian Month.
    Examples:

        assert(DateTime(Date(1999, 7, 6), TimeOfDay(9, 7, 5)).day == 6);
        assert(DateTime(Date(2010, 10, 4), TimeOfDay(0, 0, 30)).day == 4);
        assert(DateTime(Date(-7, 4, 5), TimeOfDay(7, 45, 2)).day == 5);

  pure @property @safe void `day`(int `day`);
    Day of a Gregorian Month.
    Parameters:

    int `day` | The `day` of the month to set this DateTime's `day` to.

    Throws:
    DateTimeException if the given `day` is not a valid `day` of the current month.
  const pure nothrow @property @safe ubyte `hour`();
    Hours past midnight.
  pure @property @safe void `hour`(int `hour`);
    Hours past midnight.
    Parameters:

    int `hour` | The `hour` of the day to set this DateTime's `hour` to.

    Throws:
    DateTimeException if the given `hour` would result in an invalid DateTime.
  const pure nothrow @property @safe ubyte `minute`();
    Minutes past the hour.
  pure @property @safe void `minute`(int `minute`);
    Minutes past the hour.
    Parameters:

    int `minute` | The `minute` to set this DateTime's `minute` to.

    Throws:
    DateTimeException if the given `minute` would result in an invalid DateTime.
  const pure nothrow @property @safe ubyte `second`();
    Seconds past the minute.
  pure @property @safe void `second`(int `second`);
    Seconds past the minute.
    Parameters:

    int `second` | The `second` to set this DateTime's `second` to.

    Throws:
    DateTimeException if the given seconds would result in an invalid DateTime.
  pure nothrow ref @safe DateTime `add`(string units)(long `value`, AllowDayOverflow `allowOverflow` = Yes.allowDayOverflow)
  if (units == "years" || units == "months");
    Adds the given number of years or months to this DateTime. A negative number will subtract.
    Note that if day overflow is allowed, and the date with the adjusted year/month overflows the number of days in the new month, then the month will be incremented by one, and the day set to the number of days overflowed. (e.g. if the day were 31 and the new month were June, then the month would be incremented to July, and the new day would be 1). If day overflow is not allowed, then the day will be set to the last valid day in the month (e.g. June 31st would become June 30th).
    Parameters:

    units | The type of units to `add` ("years" or "months").
    long `value` | The number of months or years to `add` to this DateTime.
    AllowDayOverflow `allowOverflow` | Whether the days should be allowed to overflow, causing the month to increment.

    Examples:

        import std.typecons : No;

        auto dt1 = DateTime(2010, 1, 1, 12, 30, 33);
        dt1.add!"months"(11);
        assert(dt1 == DateTime(2010, 12, 1, 12, 30, 33));

        auto dt2 = DateTime(2010, 1, 1, 12, 30, 33);
        dt2.add!"months"(-11);
        assert(dt2 == DateTime(2009, 2, 1, 12, 30, 33));

        auto dt3 = DateTime(2000, 2, 29, 12, 30, 33);
        dt3.add!"years"(1);
        assert(dt3 == DateTime(2001, 3, 1, 12, 30, 33));

        auto dt4 = DateTime(2000, 2, 29, 12, 30, 33);
        dt4.add!"years"(1, No.allowDayOverflow);
        assert(dt4 == DateTime(2001, 2, 28, 12, 30, 33));

  pure nothrow ref @safe DateTime `roll`(string units)(long `value`, AllowDayOverflow `allowOverflow` = Yes.allowDayOverflow)
  if (units == "years" || units == "months");
    Adds the given number of years or months to this DateTime. A negative number will subtract.
    The difference between rolling and adding is that rolling does not affect larger units. Rolling a DateTime 12 months gets the exact same DateTime. However, the days can still be affected due to the differing number of days in each month.
    Because there are no units larger than years, there is no difference between adding and rolling years.
    Parameters:

    units | The type of units to add ("years" or "months").
    long `value` | The number of months or years to add to this DateTime.
    AllowDayOverflow `allowOverflow` | Whether the days should be allowed to overflow, causing the month to increment.

    Examples:

        import std.typecons : No;

        auto dt1 = DateTime(2010, 1, 1, 12, 33, 33);
        dt1.roll!"months"(1);
        assert(dt1 == DateTime(2010, 2, 1, 12, 33, 33));

        auto dt2 = DateTime(2010, 1, 1, 12, 33, 33);
        dt2.roll!"months"(-1);
        assert(dt2 == DateTime(2010, 12, 1, 12, 33, 33));

        auto dt3 = DateTime(1999, 1, 29, 12, 33, 33);
        dt3.roll!"months"(1);
        assert(dt3 == DateTime(1999, 3, 1, 12, 33, 33));

        auto dt4 = DateTime(1999, 1, 29, 12, 33, 33);
        dt4.roll!"months"(1, No.allowDayOverflow);
        assert(dt4 == DateTime(1999, 2, 28, 12, 33, 33));

        auto dt5 = DateTime(2000, 2, 29, 12, 30, 33);
        dt5.roll!"years"(1);
        assert(dt5 == DateTime(2001, 3, 1, 12, 30, 33));

        auto dt6 = DateTime(2000, 2, 29, 12, 30, 33);
        dt6.roll!"years"(1, No.allowDayOverflow);
        assert(dt6 == DateTime(2001, 2, 28, 12, 30, 33));

  pure nothrow ref @safe DateTime `roll`(string units)(long `value`)
  if (units == "days");
    Adds the given number of units to this DateTime. A negative number will subtract.
    The difference between rolling and adding is that rolling does not affect larger units. For instance, rolling a DateTime one year's worth of days gets the exact same DateTime.
    Accepted units are "days", "minutes", "hours", "minutes", and "seconds".
    Parameters:

    units | The units to add.
    long `value` | The number of units to add to this DateTime.

    Examples:

        auto dt1 = DateTime(2010, 1, 1, 11, 23, 12);
        dt1.roll!"days"(1);
        assert(dt1 == DateTime(2010, 1, 2, 11, 23, 12));
        dt1.roll!"days"(365);
        assert(dt1 == DateTime(2010, 1, 26, 11, 23, 12));
        dt1.roll!"days"(-32);
        assert(dt1 == DateTime(2010, 1, 25, 11, 23, 12));

        auto dt2 = DateTime(2010, 7, 4, 12, 0, 0);
        dt2.roll!"hours"(1);
        assert(dt2 == DateTime(2010, 7, 4, 13, 0, 0));

        auto dt3 = DateTime(2010, 1, 1, 0, 0, 0);
        dt3.roll!"seconds"(-1);
        assert(dt3 == DateTime(2010, 1, 1, 0, 0, 59));

  const pure nothrow @safe DateTime `opBinary`(string op)(Duration `duration`)
  if (op == "+" || op == "-");
    Gives the result of adding or subtracting a core.time.Duration from this DateTime.
    The legal types of arithmetic for DateTime using this operator are

    DateTime | + | Duration | --> | DateTime
    DateTime | - | Duration | --> | DateTime

    Parameters:

    Duration `duration` | The core.time.Duration to add to or subtract from this DateTime.

    Examples:

        assert(DateTime(2015, 12, 31, 23, 59, 59) + seconds(1) ==
               DateTime(2016, 1, 1, 0, 0, 0));

        assert(DateTime(2015, 12, 31, 23, 59, 59) + hours(1) ==
               DateTime(2016, 1, 1, 0, 59, 59));

        assert(DateTime(2016, 1, 1, 0, 0, 0) - seconds(1) ==
               DateTime(2015, 12, 31, 23, 59, 59));

        assert(DateTime(2016, 1, 1, 0, 59, 59) - hours(1) ==
               DateTime(2015, 12, 31, 23, 59, 59));

  const pure nothrow @safe DateTime `opBinary`(string op)(in TickDuration `td`)
  if (op == "+" || op == "-");
    Deprecated. core.time.TickDuration is going to be deprecated in favor of core.time.MonoTime and core.time.Duration. Use Duration instead. This overload will be removed in January 2017.
    Defines + and - with core.time.TickDuration.
  pure nothrow ref @safe DateTime `opOpAssign`(string op, D)(in D `duration`)
  if ((op == "+" || op == "-") && (is(Unqual!D == Duration) || is(Unqual!D == TickDuration)));
    Gives the result of adding or subtracting a `duration` from this DateTime, as well as assigning the result to this DateTime.
    The legal types of arithmetic for DateTime using this operator are

    DateTime | + | `duration` | --> | DateTime
    DateTime | - | `duration` | --> | DateTime

    Parameters:

    D `duration` | The `duration` to add to or subtract from this DateTime.

  pure nothrow ref @safe DateTime `opOpAssign`(string op)(TickDuration `td`)
  if (op == "+" || op == "-");
    Deprecated. core.time.TickDuration is going to be deprecated in favor of core.time.MonoTime and core.time.Duration. Use Duration instead. This overload will be removed in January 2017.
    Defines += and -= with core.time.TickDuration.
  const pure nothrow @safe Duration `opBinary`(string op)(in DateTime `rhs`)
  if (op == "-");
    Gives the difference between two DateTimes.
    The legal types of arithmetic for DateTime using this operator are

    DateTime | - | DateTime | --> | duration

  const pure nothrow @safe int `diffMonths`(in DateTime `rhs`);
    Returns the difference between the two DateTimes in months.
    To get the difference in years, subtract the year property of two SysTimes. To get the difference in days or weeks, subtract the SysTimes themselves and use the core.time.Duration that results. Because converting between months and smaller units requires a specific date (which core.time.Durations don't have), getting the difference in months requires some math using both the year and month properties, so this is a convenience function for getting the difference in months.
    Note that the number of days in the months or how far into the month either date is is irrelevant. It is the difference in the month property combined with the difference in years * 12. So, for instance, December 31st and January 1st are one month apart just as December 1st and January 31st are one month apart.
    Parameters:

    DateTime `rhs` | The DateTime to subtract from this one.

    Examples:

        assert(DateTime(1999, 2, 1, 12, 2, 3).diffMonths(
                    DateTime(1999, 1, 31, 23, 59, 59)) == 1);

        assert(DateTime(1999, 1, 31, 0, 0, 0).diffMonths(
                    DateTime(1999, 2, 1, 12, 3, 42)) == -1);

        assert(DateTime(1999, 3, 1, 5, 30, 0).diffMonths(
                    DateTime(1999, 1, 1, 2, 4, 7)) == 2);

        assert(DateTime(1999, 1, 1, 7, 2, 4).diffMonths(
                    DateTime(1999, 3, 31, 0, 30, 58)) == -2);

  const pure nothrow @property @safe bool `isLeapYear`();
    Whether this DateTime is in a leap year.
  const pure nothrow @property @safe DayOfWeek `dayOfWeek`();
    Day of the week this DateTime is on.
  const pure nothrow @property @safe ushort `dayOfYear`();
    Day of the year this DateTime is on.
    Examples:

        assert(DateTime(Date(1999, 1, 1), TimeOfDay(12, 22, 7)).dayOfYear == 1);
        assert(DateTime(Date(1999, 12, 31), TimeOfDay(7, 2, 59)).dayOfYear == 365);
        assert(DateTime(Date(2000, 12, 31), TimeOfDay(21, 20, 0)).dayOfYear == 366);

  pure @property @safe void `dayOfYear`(int `day`);
    Day of the year.
    Parameters:

    int `day` | The `day` of the year to set which `day` of the year this DateTime is on.

  const pure nothrow @property @safe int `dayOfGregorianCal`();
    The Xth day of the Gregorian Calendar that this DateTime is on.
    Examples:

        assert(DateTime(Date(1, 1, 1), TimeOfDay(0, 0, 0)).dayOfGregorianCal == 1);
        assert(DateTime(Date(1, 12, 31), TimeOfDay(23, 59, 59)).dayOfGregorianCal == 365);
        assert(DateTime(Date(2, 1, 1), TimeOfDay(2, 2, 2)).dayOfGregorianCal == 366);

        assert(DateTime(Date(0, 12, 31), TimeOfDay(7, 7, 7)).dayOfGregorianCal == 0);
        assert(DateTime(Date(0, 1, 1), TimeOfDay(19, 30, 0)).dayOfGregorianCal == -365);
        assert(DateTime(Date(-1, 12, 31), TimeOfDay(4, 7, 0)).dayOfGregorianCal == -366);

        assert(DateTime(Date(2000, 1, 1), TimeOfDay(9, 30, 20)).dayOfGregorianCal == 730_120);
        assert(DateTime(Date(2010, 12, 31), TimeOfDay(15, 45, 50)).dayOfGregorianCal == 734_137);

  pure nothrow @property @safe void `dayOfGregorianCal`(int `days`);
    The Xth day of the Gregorian Calendar that this DateTime is on. Setting this property does not affect the time portion of DateTime.
    Parameters:

    int `days` | The day of the Gregorian Calendar to set this DateTime to.

    Examples:

        auto dt = DateTime(Date.init, TimeOfDay(12, 0, 0));
        dt.dayOfGregorianCal = 1;
        assert(dt == DateTime(Date(1, 1, 1), TimeOfDay(12, 0, 0)));

        dt.dayOfGregorianCal = 365;
        assert(dt == DateTime(Date(1, 12, 31), TimeOfDay(12, 0, 0)));

        dt.dayOfGregorianCal = 366;
        assert(dt == DateTime(Date(2, 1, 1), TimeOfDay(12, 0, 0)));

        dt.dayOfGregorianCal = 0;
        assert(dt == DateTime(Date(0, 12, 31), TimeOfDay(12, 0, 0)));

        dt.dayOfGregorianCal = -365;
        assert(dt == DateTime(Date(-0, 1, 1), TimeOfDay(12, 0, 0)));

        dt.dayOfGregorianCal = -366;
        assert(dt == DateTime(Date(-1, 12, 31), TimeOfDay(12, 0, 0)));

        dt.dayOfGregorianCal = 730_120;
        assert(dt == DateTime(Date(2000, 1, 1), TimeOfDay(12, 0, 0)));

        dt.dayOfGregorianCal = 734_137;
        assert(dt == DateTime(Date(2010, 12, 31), TimeOfDay(12, 0, 0)));

  const pure nothrow @property @safe ubyte `isoWeek`();
    The ISO 8601 week of the year that this DateTime is in.
    See Also:
    ISO Week Date
  const pure nothrow @property @safe DateTime `endOfMonth`();
    DateTime for the last day in the month that this DateTime is in. The time portion of `endOfMonth` is always 23:59:59.
    Examples:

        assert(DateTime(Date(1999, 1, 6), TimeOfDay(0, 0, 0)).endOfMonth ==
               DateTime(Date(1999, 1, 31), TimeOfDay(23, 59, 59)));

        assert(DateTime(Date(1999, 2, 7), TimeOfDay(19, 30, 0)).endOfMonth ==
               DateTime(Date(1999, 2, 28), TimeOfDay(23, 59, 59)));

        assert(DateTime(Date(2000, 2, 7), TimeOfDay(5, 12, 27)).endOfMonth ==
               DateTime(Date(2000, 2, 29), TimeOfDay(23, 59, 59)));

        assert(DateTime(Date(2000, 6, 4), TimeOfDay(12, 22, 9)).endOfMonth ==
               DateTime(Date(2000, 6, 30), TimeOfDay(23, 59, 59)));

  const pure nothrow @property @safe ubyte `daysInMonth`();
    The last day in the month that this DateTime is in.
    Examples:

        assert(DateTime(Date(1999, 1, 6), TimeOfDay(0, 0, 0)).daysInMonth == 31);
        assert(DateTime(Date(1999, 2, 7), TimeOfDay(19, 30, 0)).daysInMonth == 28);
        assert(DateTime(Date(2000, 2, 7), TimeOfDay(5, 12, 27)).daysInMonth == 29);
        assert(DateTime(Date(2000, 6, 4), TimeOfDay(12, 22, 9)).daysInMonth == 30);

  const pure nothrow @property @safe bool `isAD`();
    Whether the current year is a date in A.D.
    Examples:

        assert(DateTime(Date(1, 1, 1), TimeOfDay(12, 7, 0)).isAD);
        assert(DateTime(Date(2010, 12, 31), TimeOfDay(0, 0, 0)).isAD);
        assert(!DateTime(Date(0, 12, 31), TimeOfDay(23, 59, 59)).isAD);
        assert(!DateTime(Date(-2010, 1, 1), TimeOfDay(2, 2, 2)).isAD);

  const pure nothrow @property @safe long `julianDay`();
    The Julian day for this DateTime at the given time. For example, prior to noon, 1996-03-31 would be the Julian day number 2_450_173, so this function returns 2_450_173, while from noon onward, the julian day number would be 2_450_174, so this function returns 2_450_174.
  const pure nothrow @property @safe long `modJulianDay`();
    The modified Julian day for any time on this date (since, the modified Julian day changes at midnight).
  const pure nothrow @safe string `toISOString`();
    Converts this DateTime to a string with the format YYYYMMDDTHHMMSS.
    Examples:

        assert(DateTime(Date(2010, 7, 4), TimeOfDay(7, 6, 12)).toISOString() ==
               "20100704T070612");

        assert(DateTime(Date(1998, 12, 25), TimeOfDay(2, 15, 0)).toISOString() ==
               "19981225T021500");

        assert(DateTime(Date(0, 1, 5), TimeOfDay(23, 9, 59)).toISOString() ==
               "00000105T230959");

        assert(DateTime(Date(-4, 1, 5), TimeOfDay(0, 0, 2)).toISOString() ==
               "-00040105T000002");

  const pure nothrow @safe string `toISOExtString`();
    Converts this DateTime to a string with the format YYYY-MM-DDTHH:MM:SS.
    Examples:

        assert(DateTime(Date(2010, 7, 4), TimeOfDay(7, 6, 12)).toISOExtString() ==
               "2010-07-04T07:06:12");

        assert(DateTime(Date(1998, 12, 25), TimeOfDay(2, 15, 0)).toISOExtString() ==
               "1998-12-25T02:15:00");

        assert(DateTime(Date(0, 1, 5), TimeOfDay(23, 9, 59)).toISOExtString() ==
               "0000-01-05T23:09:59");

        assert(DateTime(Date(-4, 1, 5), TimeOfDay(0, 0, 2)).toISOExtString() ==
               "-0004-01-05T00:00:02");

  const pure nothrow @safe string `toSimpleString`();
    Converts this DateTime to a string with the format YYYY-Mon-DD HH:MM:SS.
    Examples:

        assert(DateTime(Date(2010, 7, 4), TimeOfDay(7, 6, 12)).toSimpleString() ==
               "2010-Jul-04 07:06:12");

        assert(DateTime(Date(1998, 12, 25), TimeOfDay(2, 15, 0)).toSimpleString() ==
               "1998-Dec-25 02:15:00");

        assert(DateTime(Date(0, 1, 5), TimeOfDay(23, 9, 59)).toSimpleString() ==
               "0000-Jan-05 23:09:59");

        assert(DateTime(Date(-4, 1, 5), TimeOfDay(0, 0, 2)).toSimpleString() ==
               "-0004-Jan-05 00:00:02");

  const pure nothrow @safe string `toString`();
    Converts this DateTime to a string.
  pure @safe DateTime `fromISOString`(S)(in S `isoString`)
  if (isSomeString!S);
    Creates a DateTime from a string with the format YYYYMMDDTHHMMSS. Whitespace is stripped from the given string.
    Parameters:

    S `isoString` | A string formatted in the ISO format for dates and times.

    Throws:
    DateTimeException if the given string is not in the ISO format or if the resulting DateTime would not be valid.
  pure @safe DateTime `fromISOExtString`(S)(in S `isoExtString`)
  if (isSomeString!S);
    Creates a DateTime from a string with the format YYYY-MM-DDTHH:MM:SS. Whitespace is stripped from the given string.
    Parameters:

    S `isoExtString` | A string formatted in the ISO Extended format for dates and times.

    Throws:
    DateTimeException if the given string is not in the ISO Extended format or if the resulting DateTime would not be valid.
  pure @safe DateTime `fromSimpleString`(S)(in S `simpleString`)
  if (isSomeString!S);
    Creates a DateTime from a string with the format YYYY-Mon-DD HH:MM:SS. Whitespace is stripped from the given string.
    Parameters:

    S `simpleString` | A string formatted in the way that toSimpleString formats dates and times.

    Throws:
    DateTimeException if the given string is not in the correct format or if the resulting DateTime would not be valid.
  static pure nothrow @property @safe DateTime `min`();
    Returns the DateTime farthest in the past which is representable by DateTime.
  static pure nothrow @property @safe DateTime `max`();
    Returns the DateTime farthest in the future which is representable by DateTime.
struct `Interval`(TP);
  Represents an interval of time.
  An `Interval` has a starting point and an end point. The interval of time is therefore the time starting at the starting point up to, but not including, the end point. e.g.

  [January 5th, 2010 - March 10th, 2010)
  [05:00:30 - 12:00:00)
  [1982-01-04T08:59:00 - 2010-07-04T12:00:00)

  A range can be obtained from an `Interval`, allowing iteration over that interval, with the exact time points which are iterated over depending on the function which generates the range.
  pure this(U)(in TP `begin`, in U `end`)
  if (is(Unqual!TP == Unqual!U));
    Parameters:

    TP `begin` | The time point which begins the interval.
    U `end` | The time point which ends (but is not included in) the interval.

    Throws:
    DateTimeException if `end` is before `begin`.

    Example:

        Interval!Date(Date(1996, 1, 2), Date(2012, 3, 1));

  pure this(D)(in TP `begin`, in D `duration`)
  if (__traits(compiles, `begin` + `duration`));
    Parameters:

    TP `begin` | The time point which begins the interval.
    D `duration` | The `duration` from the starting point to the end point.

    Throws:
    DateTimeException if the resulting end is before `begin`.

    Example:

        assert(Interval!Date(Date(1996, 1, 2), dur!"days"(3)) ==
               Interval!Date(Date(1996, 1, 2), Date(1996, 1, 5)));

  pure nothrow ref Interval `opAssign`(ref const Interval `rhs`);
    Parameters:

    Interval `rhs` | The Interval to assign to this one.

  pure nothrow ref Interval `opAssign`(Interval `rhs`);
    Parameters:

    Interval `rhs` | The Interval to assign to this one.

  const pure nothrow @property TP `begin`();
    The starting point of the interval. It is included in the interval.

    Example:

        assert(Interval!Date(Date(1996, 1, 2), Date(2012, 3, 1)).begin ==
               Date(1996, 1, 2));

  pure @property void `begin`(TP `timePoint`);
    The starting point of the interval. It is included in the interval.
    Parameters:

    TP `timePoint` | The time point to set `begin` to.

    Throws:
    DateTimeException if the resulting interval would be invalid.
  const pure nothrow @property TP `end`();
    The `end` point of the interval. It is excluded from the interval.

    Example:

        assert(Interval!Date(Date(1996, 1, 2), Date(2012, 3, 1)).end ==
               Date(2012, 3, 1));

  pure @property void `end`(TP `timePoint`);
    The `end` point of the interval. It is excluded from the interval.
    Parameters:

    TP `timePoint` | The time point to set `end` to.

    Throws:
    DateTimeException if the resulting interval would be invalid.
  const pure nothrow @property auto `length`();
    Returns the duration between begin and end.

    Example:

        assert(Interval!Date(Date(1996, 1, 2), Date(2012, 3, 1)).length ==
               dur!"days"(5903));

  const pure nothrow @property bool `empty`();
    Whether the interval's length is 0, that is, whether begin == end.

    Example:

        assert(Interval!Date(Date(1996, 1, 2), Date(1996, 1, 2)).empty);
        assert(!Interval!Date(Date(1996, 1, 2), Date(2012, 3, 1)).empty);

  const pure bool `contains`(in TP `timePoint`);
    Whether the given time point is within this interval.
    Parameters:

    TP `timePoint` | The time point to check for inclusion in this interval.

    Throws:
    DateTimeException if this interval is empty.

    Example:

        assert(!Interval!Date(Date(1996, 1, 2), Date(2012, 3, 1)).contains(
                    Date(1994, 12, 24)));

        assert(Interval!Date(Date(1996, 1, 2), Date(2012, 3, 1)).contains(
                    Date(2000, 1, 5)));
        assert(!Interval!Date(Date(1996, 1, 2), Date(2012, 3, 1)).contains(
                    Date(2012, 3, 1)));

  const pure bool `contains`(in Interval `interval`);
    Whether the given `interval` is completely within this `interval`.
    Parameters:

    Interval `interval` | The `interval` to check for inclusion in this `interval`.

    Throws:
    DateTimeException if either `interval` is empty.

    Example:

        assert(!Interval!Date(Date(1996, 1, 2), Date(2012, 3, 1)).contains(
                    Interval!Date(Date(1990, 7, 6), Date(2000, 8, 2))));

        assert(Interval!Date(Date(1996, 1, 2), Date(2012, 3, 1)).contains(
                    Interval!Date(Date(1999, 1, 12), Date(2011, 9, 17))));

        assert(!Interval!Date(Date(1996, 1, 2), Date(2012, 3, 1)).contains(
                    Interval!Date(Date(1998, 2, 28), Date(2013, 5, 1))));

  const pure bool `contains`(in PosInfInterval!TP `interval`);
    Whether the given `interval` is completely within this `interval`.
    Always returns `false` (unless this `interval` is empty), because an `interval` going to positive infinity can never be contained in a finite `interval`.
    Parameters:

    PosInfInterval!TP `interval` | The `interval` to check for inclusion in this `interval`.

    Throws:
    DateTimeException if this `interval` is empty.

    Example:

        assert(!Interval!Date(Date(1996, 1, 2), Date(2012, 3, 1)).contains(
                    PosInfInterval!Date(Date(1999, 5, 4))));

  const pure bool `contains`(in NegInfInterval!TP `interval`);
    Whether the given `interval` is completely within this `interval`.
    Always returns `false` (unless this `interval` is empty), because an `interval` beginning at negative infinity can never be contained in a finite `interval`.
    Parameters:

    NegInfInterval!TP `interval` | The `interval` to check for inclusion in this `interval`.

    Throws:
    DateTimeException if this `interval` is empty.

    Example:

        assert(!Interval!Date(Date(1996, 1, 2), Date(2012, 3, 1)).contains(
                    NegInfInterval!Date(Date(1996, 5, 4))));

  const pure bool `isBefore`(in TP `timePoint`);
    Whether this interval is before the given time point.
    Parameters:

    TP `timePoint` | The time point to check whether this interval is before it.

    Throws:
    DateTimeException if this interval is empty.

    Example:

        assert(!Interval!Date(Date(1996, 1, 2), Date(2012, 3, 1)).isBefore(
                    Date(1994, 12, 24)));

        assert(!Interval!Date(Date(1996, 1, 2), Date(2012, 3, 1)).isBefore(
                    Date(2000, 1, 5)));

        assert(Interval!Date(Date(1996, 1, 2), Date(2012, 3, 1)).isBefore(
                    Date(2012, 3, 1)));

  const pure bool `isBefore`(in Interval `interval`);
    Whether this `interval` is before the given `interval` and does not intersect with it.
    Parameters:

    Interval `interval` | The `interval` to check for against this `interval`.

    Throws:
    DateTimeException if either `interval` is empty.

    Example:

        assert(!Interval!Date(Date(1996, 1, 2), Date(2012, 3, 1)).isBefore(
                    Interval!Date(Date(1990, 7, 6), Date(2000, 8, 2))));

        assert(!Interval!Date(Date(1996, 1, 2), Date(2012, 3, 1)).isBefore(
                    Interval!Date(Date(1999, 1, 12), Date(2011, 9, 17))));

        assert(Interval!Date(Date(1996, 1, 2), Date(2012, 3, 1)).isBefore(
                    Interval!Date(Date(2012, 3, 1), Date(2013, 5, 1))));

  const pure bool `isBefore`(in PosInfInterval!TP `interval`);
    Whether this `interval` is before the given `interval` and does not intersect with it.
    Parameters:

    PosInfInterval!TP `interval` | The `interval` to check for against this `interval`.

    Throws:
    DateTimeException if this `interval` is empty.

    Example:

        assert(!Interval!Date(Date(1996, 1, 2), Date(2012, 3, 1)).isBefore(
                    PosInfInterval!Date(Date(1999, 5, 4))));

        assert(Interval!Date(Date(1996, 1, 2), Date(2012, 3, 1)).isBefore(
                    PosInfInterval!Date(Date(2013, 3, 7))));

  const pure bool `isBefore`(in NegInfInterval!TP `interval`);
    Whether this `interval` is before the given `interval` and does not intersect with it.
    Always returns `false` (unless this `interval` is empty) because a finite `interval` can never be before an `interval` beginning at negative infinity.
    Parameters:

    NegInfInterval!TP `interval` | The `interval` to check for against this `interval`.

    Throws:
    DateTimeException if this `interval` is empty.

    Example:

        assert(!Interval!Date(Date(1996, 1, 2), Date(2012, 3, 1)).isBefore(
                    NegInfInterval!Date(Date(1996, 5, 4))));

  const pure bool `isAfter`(in TP `timePoint`);
    Whether this interval is after the given time point.
    Parameters:

    TP `timePoint` | The time point to check whether this interval is after it.

    Throws:
    DateTimeException if this interval is empty.

    Example:

        assert(Interval!Date(Date(1996, 1, 2), Date(2012, 3, 1)).isAfter(
                    Date(1994, 12, 24)));

        assert(!Interval!Date(Date(1996, 1, 2), Date(2012, 3, 1)).isAfter(
                    Date(2000, 1, 5)));

        assert(!Interval!Date(Date(1996, 1, 2), Date(2012, 3, 1)).isAfter(
                    Date(2012, 3, 1)));

  const pure bool `isAfter`(in Interval `interval`);
    Whether this `interval` is after the given `interval` and does not intersect it.
    Parameters:

    Interval `interval` | The `interval` to check against this `interval`.

    Throws:
    DateTimeException if either `interval` is empty.

    Example:

        assert(!Interval!Date(Date(1996, 1, 2), Date(2012, 3, 1)).isAfter(
                    Interval!Date(Date(1990, 7, 6), Date(2000, 8, 2))));

        assert(!Interval!Date(Date(1996, 1, 2), Date(2012, 3, 1)).isAfter(
                    Interval!Date(Date(1999, 1, 12), Date(2011, 9, 17))));

        assert(Interval!Date(Date(1996, 1, 2), Date(2012, 3, 1)).isAfter(
                    Interval!Date(Date(1989, 3, 1), Date(1996, 1, 2))));

  const pure bool `isAfter`(in PosInfInterval!TP `interval`);
    Whether this `interval` is after the given `interval` and does not intersect it.
    Always returns `false` (unless this `interval` is empty) because a finite `interval` can never be after an `interval` going to positive infinity.
    Parameters:

    PosInfInterval!TP `interval` | The `interval` to check against this `interval`.

    Throws:
    DateTimeException if this `interval` is empty.

    Example:

        assert(!Interval!Date(Date(1996, 1, 2), Date(2012, 3, 1)).isAfter(
                    PosInfInterval!Date(Date(1999, 5, 4))));

  const pure bool `isAfter`(in NegInfInterval!TP `interval`);
    Whether this `interval` is after the given `interval` and does not intersect it.
    Parameters:

    NegInfInterval!TP `interval` | The `interval` to check against this `interval`.

    Throws:
    DateTimeException if this `interval` is empty.

    Example:

        assert(Interval!Date(Date(1996, 1, 2), Date(2012, 3, 1)).isAfter(
                    NegInfInterval!Date(Date(1996, 1, 2))));

  const pure bool `intersects`(in Interval `interval`);
    Whether the given `interval` overlaps this `interval`.
    Parameters:

    Interval `interval` | The `interval` to check for intersection with this `interval`.

    Throws:
    DateTimeException if either `interval` is empty.

    Example:

        assert(Interval!Date(Date(1996, 1, 2), Date(2012, 3, 1)).intersects(
                    Interval!Date(Date(1990, 7, 6), Date(2000, 8, 2))));

        assert(Interval!Date(Date(1996, 1, 2), Date(2012, 3, 1)).intersects(
                    Interval!Date(Date(1999, 1, 12), Date(2011, 9, 17))));

        assert(!Interval!Date(Date(1996, 1, 2), Date(2012, 3, 1)).intersects(
                    Interval!Date(Date(1989, 3, 1), Date(1996, 1, 2))));

  const pure bool `intersects`(in PosInfInterval!TP `interval`);
    Whether the given `interval` overlaps this `interval`.
    Parameters:

    PosInfInterval!TP `interval` | The `interval` to check for intersection with this `interval`.

    Throws:
    DateTimeException if this `interval` is empty.

    Example:

        assert(Interval!Date(Date(1996, 1, 2), Date(2012, 3, 1)).intersects(
                    PosInfInterval!Date(Date(1999, 5, 4))));

        assert(!Interval!Date(Date(1996, 1, 2), Date(2012, 3, 1)).intersects(
                    PosInfInterval!Date(Date(2012, 3, 1))));

  const pure bool `intersects`(in NegInfInterval!TP `interval`);
    Whether the given `interval` overlaps this `interval`.
    Parameters:

    NegInfInterval!TP `interval` | The `interval` to check for intersection with this `interval`.

    Throws:
    DateTimeException if this `interval` is empty.

    Example:

        assert(!Interval!Date(Date(1996, 1, 2), Date(2012, 3, 1)).intersects(
                    NegInfInterval!Date(Date(1996, 1, 2))));

        assert(Interval!Date(Date(1996, 1, 2), Date(2012, 3, 1)).intersects(
                    NegInfInterval!Date(Date(2000, 1, 2))));

  const Interval `intersection`(in Interval `interval`);
    Returns the `intersection` of two intervals
    Parameters:

    Interval `interval` | The `interval` to intersect with this `interval`.

    Throws:
    DateTimeException if the two intervals do not intersect or if either `interval` is empty.

    Example:

        assert(Interval!Date(Date(1996, 1, 2), Date(2012, 3, 1)).intersection(
                    Interval!Date(Date(1990, 7, 6), Date(2000, 8, 2))) ==
               Interval!Date(Date(1996, 1 , 2), Date(2000, 8, 2)));

        assert(Interval!Date(Date(1996, 1, 2), Date(2012, 3, 1)).intersection(
                    Interval!Date(Date(1999, 1, 12), Date(2011, 9, 17))) ==
               Interval!Date(Date(1999, 1 , 12), Date(2011, 9, 17)));

  const Interval `intersection`(in PosInfInterval!TP `interval`);
    Returns the `intersection` of two intervals
    Parameters:

    PosInfInterval!TP `interval` | The `interval` to intersect with this `interval`.

    Throws:
    DateTimeException if the two intervals do not intersect or if this `interval` is empty.

    Example:

        assert(Interval!Date(Date(1996, 1, 2), Date(2012, 3, 1)).intersection(
                    PosInfInterval!Date(Date(1990, 7, 6))) ==
               Interval!Date(Date(1996, 1 , 2), Date(2012, 3, 1)));

        assert(Interval!Date(Date(1996, 1, 2), Date(2012, 3, 1)).intersection(
                    PosInfInterval!Date(Date(1999, 1, 12))) ==
               Interval!Date(Date(1999, 1 , 12), Date(2012, 3, 1)));

  const Interval `intersection`(in NegInfInterval!TP `interval`);
    Returns the `intersection` of two intervals
    Parameters:

    NegInfInterval!TP `interval` | The `interval` to intersect with this `interval`.

    Throws:
    DateTimeException if the two intervals do not intersect or if this `interval` is empty.

    Example:

        assert(Interval!Date(Date(1996, 1, 2), Date(2012, 3, 1)).intersection(
                    NegInfInterval!Date(Date(1999, 7, 6))) ==
               Interval!Date(Date(1996, 1 , 2), Date(1999, 7, 6)));

        assert(Interval!Date(Date(1996, 1, 2), Date(2012, 3, 1)).intersection(
                    NegInfInterval!Date(Date(2013, 1, 12))) ==
               Interval!Date(Date(1996, 1 , 2), Date(2012, 3, 1)));

  const pure bool `isAdjacent`(in Interval `interval`);
    Whether the given `interval` is adjacent to this `interval`.
    Parameters:

    Interval `interval` | The `interval` to check whether its adjecent to this `interval`.

    Throws:
    DateTimeException if either `interval` is empty.

    Example:

        assert(Interval!Date(Date(1996, 1, 2), Date(2012, 3, 1)).isAdjacent(
                    Interval!Date(Date(1990, 7, 6), Date(1996, 1, 2))));

        assert(Interval!Date(Date(1996, 1, 2), Date(2012, 3, 1)).isAdjacent(
                    Interval!Date(Date(2012, 3, 1), Date(2013, 9, 17))));

        assert(!Interval!Date(Date(1996, 1, 2), Date(2012, 3, 1)).isAdjacent(
                    Interval!Date(Date(1989, 3, 1), Date(2012, 3, 1))));

  const pure bool `isAdjacent`(in PosInfInterval!TP `interval`);
    Whether the given `interval` is adjacent to this `interval`.
    Parameters:

    PosInfInterval!TP `interval` | The `interval` to check whether its adjecent to this `interval`.

    Throws:
    DateTimeException if this `interval` is empty.

    Example:

        assert(!Interval!Date(Date(1996, 1, 2), Date(2012, 3, 1)).isAdjacent(
                    PosInfInterval!Date(Date(1999, 5, 4))));

        assert(Interval!Date(Date(1996, 1, 2), Date(2012, 3, 1)).isAdjacent(
                    PosInfInterval!Date(Date(2012, 3, 1))));

  const pure bool `isAdjacent`(in NegInfInterval!TP `interval`);
    Whether the given `interval` is adjacent to this `interval`.
    Parameters:

    NegInfInterval!TP `interval` | The `interval` to check whether its adjecent to this `interval`.

    Throws:
    DateTimeException if this `interval` is empty.

    Example:

        assert(Interval!Date(Date(1996, 1, 2), Date(2012, 3, 1)).isAdjacent(
                    NegInfInterval!Date(Date(1996, 1, 2))));

        assert(!Interval!Date(Date(1996, 1, 2), Date(2012, 3, 1)).isAdjacent(
                    NegInfInterval!Date(Date(2000, 1, 2))));

  const Interval `merge`(in Interval `interval`);
    Returns the union of two intervals
    Parameters:

    Interval `interval` | The `interval` to `merge` with this `interval`.

    Throws:
    DateTimeException if the two intervals do not intersect and are not adjacent or if either `interval` is empty.

    Example:

        assert(Interval!Date(Date(1996, 1, 2), Date(2012, 3, 1)).merge(
                    Interval!Date(Date(1990, 7, 6), Date(2000, 8, 2))) ==
               Interval!Date(Date(1990, 7 , 6), Date(2012, 3, 1)));

        assert(Interval!Date(Date(1996, 1, 2), Date(2012, 3, 1)).merge(
                    Interval!Date(Date(2012, 3, 1), Date(2013, 5, 7))) ==
               Interval!Date(Date(1996, 1 , 2), Date(2013, 5, 7)));

  const PosInfInterval!TP `merge`(in PosInfInterval!TP `interval`);
    Returns the union of two intervals
    Parameters:

    PosInfInterval!TP `interval` | The `interval` to `merge` with this `interval`.

    Throws:
    DateTimeException if the two intervals do not intersect and are not adjacent or if this `interval` is empty.

    Example:

        assert(Interval!Date(Date(1996, 1, 2), Date(2012, 3, 1)).merge(
                    PosInfInterval!Date(Date(1990, 7, 6))) ==
               PosInfInterval!Date(Date(1990, 7 , 6)));

        assert(Interval!Date(Date(1996, 1, 2), Date(2012, 3, 1)).merge(
                    PosInfInterval!Date(Date(2012, 3, 1))) ==
               PosInfInterval!Date(Date(1996, 1 , 2)));

  const NegInfInterval!TP `merge`(in NegInfInterval!TP `interval`);
    Returns the union of two intervals
    Parameters:

    NegInfInterval!TP `interval` | The `interval` to `merge` with this `interval`.

    Throws:
    DateTimeException if the two intervals do not intersect and are not adjacent or if this `interval` is empty.

    Example:

        assert(Interval!Date(Date(1996, 1, 2), Date(2012, 3, 1)).merge(
                    NegInfInterval!Date(Date(1996, 1, 2))) ==
               NegInfInterval!Date(Date(2012, 3 , 1)));

        assert(Interval!Date(Date(1996, 1, 2), Date(2012, 3, 1)).merge(
                    NegInfInterval!Date(Date(2013, 1, 12))) ==
               NegInfInterval!Date(Date(2013, 1 , 12)));

  const pure Interval `span`(in Interval `interval`);
    Returns an `interval` that covers from the earliest time point of two intervals up to (but not including) the latest time point of two intervals.
    Parameters:

    Interval `interval` | The `interval` to create a `span` together with this `interval`.

    Throws:
    DateTimeException if either `interval` is empty.

    Example:

        assert(Interval!Date(Date(1996, 1, 2), Date(2012, 3, 1)).span(
                    Interval!Date(Date(1990, 7, 6), Date(1991, 1, 8))) ==
               Interval!Date(Date(1990, 7 , 6), Date(2012, 3, 1)));

        assert(Interval!Date(Date(1996, 1, 2), Date(2012, 3, 1)).span(
                    Interval!Date(Date(2012, 3, 1), Date(2013, 5, 7))) ==
               Interval!Date(Date(1996, 1 , 2), Date(2013, 5, 7)));

  const pure PosInfInterval!TP `span`(in PosInfInterval!TP `interval`);
    Returns an `interval` that covers from the earliest time point of two intervals up to (but not including) the latest time point of two intervals.
    Parameters:

    PosInfInterval!TP `interval` | The `interval` to create a `span` together with this `interval`.

    Throws:
    DateTimeException if this `interval` is empty.

    Example:

        assert(Interval!Date(Date(1996, 1, 2), Date(2012, 3, 1)).span(
                    PosInfInterval!Date(Date(1990, 7, 6))) ==
               PosInfInterval!Date(Date(1990, 7 , 6)));

        assert(Interval!Date(Date(1996, 1, 2), Date(2012, 3, 1)).span(
                    PosInfInterval!Date(Date(2050, 1, 1))) ==
               PosInfInterval!Date(Date(1996, 1 , 2)));

  const pure NegInfInterval!TP `span`(in NegInfInterval!TP `interval`);
    Returns an `interval` that covers from the earliest time point of two intervals up to (but not including) the latest time point of two intervals.
    Parameters:

    NegInfInterval!TP `interval` | The `interval` to create a `span` together with this `interval`.

    Throws:
    DateTimeException if this `interval` is empty.

    Example:

        assert(Interval!Date(Date(1996, 1, 2), Date(2012, 3, 1)).span(
                    NegInfInterval!Date(Date(1602, 5, 21))) ==
               NegInfInterval!Date(Date(2012, 3 , 1)));

        assert(Interval!Date(Date(1996, 1, 2), Date(2012, 3, 1)).span(
                    NegInfInterval!Date(Date(2013, 1, 12))) ==
               NegInfInterval!Date(Date(2013, 1 , 12)));

  pure void `shift`(D)(D `duration`)
  if (__traits(compiles, begin + `duration`));
    Shifts the interval forward or backwards in time by the given `duration` (a positive `duration` shifts the interval forward; a negative `duration` shifts it backward). Effectively, it does begin += `duration` and end += `duration`.
    Parameters:

    D `duration` | The `duration` to `shift` the interval by.

    Throws:
    DateTimeException this interval is empty or if the resulting interval would be invalid.

    Example:

        auto interval1 = Interval!Date(Date(1996, 1, 2), Date(2012, 4, 5));
        auto interval2 = Interval!Date(Date(1996, 1, 2), Date(2012, 4, 5));

        interval1.shift(dur!"days"(50));
        assert(interval1 == Interval!Date(Date(1996, 2, 21), Date(2012, 5, 25)));

        interval2.shift(dur!"days"(-50));
        assert(interval2 == Interval!Date(Date(1995, 11, 13), Date(2012, 2, 15)));

  void `shift`(T)(T `years`, T `months` = 0, AllowDayOverflow `allowOverflow` = Yes.allowDayOverflow)
  if (isIntegral!T);
    Shifts the interval forward or backwards in time by the given number of `years` and/or `months` (a positive number of `years` and `months` shifts the interval forward; a negative number shifts it backward). It adds the `years` the given `years` and `months` to both begin and end. It effectively calls add!"`years`"() and then add!"`months`"() on begin and end with the given number of `years` and `months`.
    Parameters:

    T `years` | The number of `years` to `shift` the interval by.
    T `months` | The number of `months` to `shift` the interval by.
    AllowDayOverflow `allowOverflow` | Whether the days should be allowed to overflow on begin and end, causing their month to increment.

    Throws:
    DateTimeException if this interval is empty or if the resulting interval would be invalid.

    Example:

        auto interval1 = Interval!Date(Date(1996, 1, 2), Date(2012, 3, 1));
        auto interval2 = Interval!Date(Date(1996, 1, 2), Date(2012, 3, 1));

        interval1.shift(2);
        assert(interval1 == Interval!Date(Date(1998, 1, 2), Date(2014, 3, 1)));

        interval2.shift(-2);
        assert(interval2 == Interval!Date(Date(1994, 1, 2), Date(2010, 3, 1)));

  pure void `expand`(D)(D `duration`, Direction `dir` = Direction.both)
  if (__traits(compiles, begin + `duration`));
    Expands the interval forwards and/or backwards in time. Effectively, it does begin -= `duration` and/or end += `duration`. Whether it expands forwards and/or backwards in time is determined by `dir`.
    Parameters:

    D `duration` | The `duration` to `expand` the interval by.
    Direction `dir` | The direction in time to `expand` the interval.

    Throws:
    DateTimeException this interval is empty or if the resulting interval would be invalid.

    Example:

        auto interval1 = Interval!Date(Date(1996, 1, 2), Date(2012, 3, 1));
        auto interval2 = Interval!Date(Date(1996, 1, 2), Date(2012, 3, 1));

        interval1.expand(2);
        assert(interval1 == Interval!Date(Date(1994, 1, 2), Date(2014, 3, 1)));

        interval2.expand(-2);
        assert(interval2 == Interval!Date(Date(1998, 1, 2), Date(2010, 3, 1)));

  void `expand`(T)(T `years`, T `months` = 0, AllowDayOverflow `allowOverflow` = Yes.allowDayOverflow, Direction `dir` = Direction.both)
  if (isIntegral!T);
    Expands the interval forwards and/or backwards in time. Effectively, it subtracts the given number of `months`/`years` from begin and adds them to end. Whether it expands forwards and/or backwards in time is determined by `dir`.
    Parameters:

    T `years` | The number of `years` to `expand` the interval by.
    T `months` | The number of `months` to `expand` the interval by.
    AllowDayOverflow `allowOverflow` | Whether the days should be allowed to overflow on begin and end, causing their month to increment.
    Direction `dir` | The direction in time to `expand` the interval.

    Throws:
    DateTimeException if this interval is empty or if the resulting interval would be invalid.

    Example:

        auto interval1 = Interval!Date(Date(1996, 1, 2), Date(2012, 3, 1));
        auto interval2 = Interval!Date(Date(1996, 1, 2), Date(2012, 3, 1));

        interval1.expand(2);
        assert(interval1 == Interval!Date(Date(1994, 1, 2), Date(2014, 3, 1)));

        interval2.expand(-2);
        assert(interval2 == Interval!Date(Date(1998, 1, 2), Date(2010, 3, 1)));

  const IntervalRange!(TP, Direction.fwd) `fwdRange`(TP delegate(in TP) `func`, PopFirst `popFirst` = No.`popFirst`);
    Returns a range which iterates forward over the interval, starting at begin, using `func` to generate each successive time point.
    The range's front is the interval's begin. `func` is used to generate the next front when popFront is called. If `popFirst` is Yes.`popFirst`, then popFront is called before the range is returned (so that front is a time point which `func` would generate).
    If `func` ever generates a time point less than or equal to the current front of the range, then a DateTimeException will be thrown. The range will be empty and iteration complete when `func` generates a time point equal to or beyond the end of the interval.
    There are helper functions in this module which generate common delegates to pass to `fwdRange`. Their documentation starts with "Range-generating function," making them easily searchable.
    Parameters:

    TP delegate(in TP) `func` | The function used to generate the time points of the range over the interval.
    PopFirst `popFirst` | Whether popFront should be called on the range before returning it.

    Throws:
    DateTimeException if this interval is empty.

    Warning: `func` must be logically pure. Ideally, `func` would be a function pointer to a pure function, but forcing `func` to be pure is far too restrictive to be useful, and in order to have the ease of use of having functions which generate functions to pass to `fwdRange`, `func` must be a delegate.

    If `func` retains state which changes as it is called, then some algorithms will not work correctly, because the range's save will have failed to have really saved the range's state. To avoid such bugs, don't pass a delegate which is not logically pure to `fwdRange`. If `func` is given the same time point with two different calls, it must return the same result both times.
    Of course, none of the functions in this module have this problem, so it's only relevant if when creating a custom delegate.

    Example:

        auto interval = Interval!Date(Date(2010, 9, 1), Date(2010, 9, 9));
        auto func = delegate (in Date date) //For iterating over even-numbered days.
                    {
                        if ((date.day & 1) == 0)
                            return date + dur!"days"(2);

                        return date + dur!"days"(1);
                    };
        auto range = interval.fwdRange(func);

         //An odd day. Using Yes.popFirst would have made this Date(2010, 9, 2).
        assert(range.front == Date(2010, 9, 1));

        range.popFront();
        assert(range.front == Date(2010, 9, 2));

        range.popFront();
        assert(range.front == Date(2010, 9, 4));

        range.popFront();
        assert(range.front == Date(2010, 9, 6));

        range.popFront();
        assert(range.front == Date(2010, 9, 8));

        range.popFront();
        assert(range.empty);

  const IntervalRange!(TP, Direction.bwd) `bwdRange`(TP delegate(in TP) `func`, PopFirst `popFirst` = No.`popFirst`);
    Returns a range which iterates backwards over the interval, starting at end, using `func` to generate each successive time point.
    The range's front is the interval's end. `func` is used to generate the next front when popFront is called. If `popFirst` is Yes.`popFirst`, then popFront is called before the range is returned (so that front is a time point which `func` would generate).
    If `func` ever generates a time point greater than or equal to the current front of the range, then a DateTimeException will be thrown. The range will be empty and iteration complete when `func` generates a time point equal to or less than the begin of the interval.
    There are helper functions in this module which generate common delegates to pass to `bwdRange`. Their documentation starts with "Range-generating function," making them easily searchable.
    Parameters:

    TP delegate(in TP) `func` | The function used to generate the time points of the range over the interval.
    PopFirst `popFirst` | Whether popFront should be called on the range before returning it.

    Throws:
    DateTimeException if this interval is empty.

    Warning: `func` must be logically pure. Ideally, `func` would be a function pointer to a pure function, but forcing `func` to be pure is far too restrictive to be useful, and in order to have the ease of use of having functions which generate functions to pass to fwdRange, `func` must be a delegate.

    If `func` retains state which changes as it is called, then some algorithms will not work correctly, because the range's save will have failed to have really saved the range's state. To avoid such bugs, don't pass a delegate which is not logically pure to fwdRange. If `func` is given the same time point with two different calls, it must return the same result both times.
    Of course, none of the functions in this module have this problem, so it's only relevant for custom delegates.

    Example:

        auto interval = Interval!Date(Date(2010, 9, 1), Date(2010, 9, 9));
        auto func = delegate (in Date date) //For iterating over even-numbered days.
                    {
                        if ((date.day & 1) == 0)
                            return date - dur!"days"(2);

                        return date - dur!"days"(1);
                    };
        auto range = interval.bwdRange(func);

        //An odd day. Using Yes.popFirst would have made this Date(2010, 9, 8).
        assert(range.front == Date(2010, 9, 9));

        range.popFront();
        assert(range.front == Date(2010, 9, 8));

        range.popFront();
        assert(range.front == Date(2010, 9, 6));

        range.popFront();
        assert(range.front == Date(2010, 9, 4));

        range.popFront();
        assert(range.front == Date(2010, 9, 2));

        range.popFront();
        assert(range.empty);

  const nothrow string `toString`();
    Converts this interval to a string.
struct `PosInfInterval`(TP);
  Represents an interval of time which has positive infinity as its end point.
  Any ranges which iterate over a `PosInfInterval` are infinite. So, the main purpose of using `PosInfInterval` is to create an infinite range which starts at a fixed point in time and goes to positive infinity.
  pure nothrow this(in TP `begin`);
    Parameters:

    TP `begin` | The time point which begins the interval.

    Example:

        auto interval = PosInfInterval!Date(Date(1996, 1, 2));

  pure nothrow ref PosInfInterval `opAssign`(ref const PosInfInterval `rhs`);
    Parameters:

    PosInfInterval `rhs` | The PosInfInterval to assign to this one.

  pure nothrow ref PosInfInterval `opAssign`(PosInfInterval `rhs`);
    Parameters:

    PosInfInterval `rhs` | The PosInfInterval to assign to this one.

  const pure nothrow @property TP `begin`();
    The starting point of the interval. It is included in the interval.

    Example:

        assert(PosInfInterval!Date(Date(1996, 1, 2)).begin == Date(1996, 1, 2));

  pure nothrow @property void `begin`(TP `timePoint`);
    The starting point of the interval. It is included in the interval.
    Parameters:

    TP `timePoint` | The time point to set `begin` to.

  enum bool `empty`;
    Whether the interval's length is 0. Always returns `false`.

    Example:

        assert(!PosInfInterval!Date(Date(1996, 1, 2)).empty);

  const pure nothrow bool `contains`(TP `timePoint`);
    Whether the given time point is within this interval.
    Parameters:

    TP `timePoint` | The time point to check for inclusion in this interval.

    Example:

        assert(!PosInfInterval!Date(Date(1996, 1, 2)).contains(Date(1994, 12, 24)));
        assert(PosInfInterval!Date(Date(1996, 1, 2)).contains(Date(2000, 1, 5)));

  const pure bool `contains`(in Interval!TP `interval`);
    Whether the given `interval` is completely within this `interval`.
    Parameters:

    Interval!TP `interval` | The `interval` to check for inclusion in this `interval`.

    Throws:
    DateTimeException if the given `interval` is empty.

    Example:

        assert(!PosInfInterval!Date(Date(1996, 1, 2)).contains(
                    Interval!Date(Date(1990, 7, 6), Date(2000, 8, 2))));

        assert(PosInfInterval!Date(Date(1996, 1, 2)).contains(
                    Interval!Date(Date(1999, 1, 12), Date(2011, 9, 17))));

        assert(PosInfInterval!Date(Date(1996, 1, 2)).contains(
                    Interval!Date(Date(1998, 2, 28), Date(2013, 5, 1))));

  const pure nothrow bool `contains`(in PosInfInterval `interval`);
    Whether the given `interval` is completely within this `interval`.
    Parameters:

    PosInfInterval `interval` | The `interval` to check for inclusion in this `interval`.

    Example:

        assert(PosInfInterval!Date(Date(1996, 1, 2)).contains(
                    PosInfInterval!Date(Date(1999, 5, 4))));

        assert(!PosInfInterval!Date(Date(1996, 1, 2)).contains(
                    PosInfInterval!Date(Date(1995, 7, 2))));

  const pure nothrow bool `contains`(in NegInfInterval!TP `interval`);
    Whether the given `interval` is completely within this `interval`.
    Always returns `false` because an `interval` going to positive infinity can never contain an `interval` beginning at negative infinity.
    Parameters:

    NegInfInterval!TP `interval` | The `interval` to check for inclusion in this `interval`.

    Example:

        assert(!PosInfInterval!Date(Date(1996, 1, 2)).contains(
                    NegInfInterval!Date(Date(1996, 5, 4))));

  const pure nothrow bool `isBefore`(in TP `timePoint`);
    Whether this interval is before the given time point.
    Always returns `false` because an interval going to positive infinity can never be before any time point.
    Parameters:

    TP `timePoint` | The time point to check whether this interval is before it.

    Example:

        assert(!PosInfInterval!Date(Date(1996, 1, 2)).isBefore(Date(1994, 12, 24)));
        assert(!PosInfInterval!Date(Date(1996, 1, 2)).isBefore(Date(2000, 1, 5)));

  const pure bool `isBefore`(in Interval!TP `interval`);
    Whether this `interval` is before the given `interval` and does not intersect it.
    Always returns `false` (unless the given `interval` is empty) because an `interval` going to positive infinity can never be before any other `interval`.
    Parameters:

    Interval!TP `interval` | The `interval` to check for against this `interval`.

    Throws:
    DateTimeException if the given `interval` is empty.

    Example:

        assert(!PosInfInterval!Date(Date(1996, 1, 2)).isBefore(
                    Interval!Date(Date(1990, 7, 6), Date(2000, 8, 2))));

        assert(!PosInfInterval!Date(Date(1996, 1, 2)).isBefore(
                    Interval!Date(Date(1999, 1, 12), Date(2011, 9, 17))));

  const pure nothrow bool `isBefore`(in PosInfInterval `interval`);
    Whether this `interval` is before the given `interval` and does not intersect it.
    Always returns `false` because an `interval` going to positive infinity can never be before any other `interval`.
    Parameters:

    PosInfInterval `interval` | The `interval` to check for against this `interval`.

    Example:

        assert(!PosInfInterval!Date(Date(1996, 1, 2)).isBefore(
                    PosInfInterval!Date(Date(1992, 5, 4))));

        assert(!PosInfInterval!Date(Date(1996, 1, 2)).isBefore(
                    PosInfInterval!Date(Date(2013, 3, 7))));

  const pure nothrow bool `isBefore`(in NegInfInterval!TP `interval`);
    Whether this `interval` is before the given `interval` and does not intersect it.
    Always returns `false` because an `interval` going to positive infinity can never be before any other `interval`.
    Parameters:

    NegInfInterval!TP `interval` | The `interval` to check for against this `interval`.

    Example:

        assert(!PosInfInterval!Date(Date(1996, 1, 2)).isBefore(
                    NegInfInterval!Date(Date(1996, 5, 4))));

  const pure nothrow bool `isAfter`(in TP `timePoint`);
    Whether this interval is after the given time point.
    Parameters:

    TP `timePoint` | The time point to check whether this interval is after it.

    Example:

        assert(PosInfInterval!Date(Date(1996, 1, 2)).isAfter(Date(1994, 12, 24)));
        assert(!PosInfInterval!Date(Date(1996, 1, 2)).isAfter(Date(2000, 1, 5)));

  const pure bool `isAfter`(in Interval!TP `interval`);
    Whether this `interval` is after the given `interval` and does not intersect it.
    Parameters:

    Interval!TP `interval` | The `interval` to check against this `interval`.

    Throws:
    DateTimeException if the given `interval` is empty.

    Example:

        assert(!PosInfInterval!Date(Date(1996, 1, 2)).isAfter(
                    Interval!Date(Date(1990, 7, 6), Date(2000, 8, 2))));

        assert(!PosInfInterval!Date(Date(1996, 1, 2)).isAfter(
                    Interval!Date(Date(1999, 1, 12), Date(2011, 9, 17))));

        assert(PosInfInterval!Date(Date(1996, 1, 2)).isAfter(
                    Interval!Date(Date(1989, 3, 1), Date(1996, 1, 2))));

  const pure nothrow bool `isAfter`(in PosInfInterval `interval`);
    Whether this `interval` is after the given `interval` and does not intersect it.
    Always returns `false` because an `interval` going to positive infinity can never be after another `interval` going to positive infinity.
    Parameters:

    PosInfInterval `interval` | The `interval` to check against this `interval`.

    Example:

        assert(!PosInfInterval!Date(Date(1996, 1, 2)).isAfter(
                    PosInfInterval!Date(Date(1990, 1, 7))));

        assert(!PosInfInterval!Date(Date(1996, 1, 2)).isAfter(
                    PosInfInterval!Date(Date(1999, 5, 4))));

  const pure nothrow bool `isAfter`(in NegInfInterval!TP `interval`);
    Whether this `interval` is after the given `interval` and does not intersect it.
    Parameters:

    NegInfInterval!TP `interval` | The `interval` to check against this `interval`.

    Example:

        assert(PosInfInterval!Date(Date(1996, 1, 2)).isAfter(
                    NegInfInterval!Date(Date(1996, 1, 2))));

        assert(!PosInfInterval!Date(Date(1996, 1, 2)).isAfter(
                    NegInfInterval!Date(Date(2000, 7, 1))));

  const pure bool `intersects`(in Interval!TP `interval`);
    Whether the given `interval` overlaps this `interval`.
    Parameters:

    Interval!TP `interval` | The `interval` to check for intersection with this `interval`.

    Throws:
    DateTimeException if the given `interval` is empty.

    Example:

        assert(PosInfInterval!Date(Date(1996, 1, 2)).intersects(
                    Interval!Date(Date(1990, 7, 6), Date(2000, 8, 2))));

        assert(PosInfInterval!Date(Date(1996, 1, 2)).intersects(
                    Interval!Date(Date(1999, 1, 12), Date(2011, 9, 17))));

        assert(!PosInfInterval!Date(Date(1996, 1, 2)).intersects(
                    Interval!Date(Date(1989, 3, 1), Date(1996, 1, 2))));

  const pure nothrow bool `intersects`(in PosInfInterval `interval`);
    Whether the given `interval` overlaps this `interval`.
    Always returns `true` because two intervals going to positive infinity always overlap.
    Parameters:

    PosInfInterval `interval` | The `interval` to check for intersection with this `interval`.

    Example:

        assert(PosInfInterval!Date(Date(1996, 1, 2)).intersects(
                    PosInfInterval!Date(Date(1990, 1, 7))));

        assert(PosInfInterval!Date(Date(1996, 1, 2)).intersects(
                    PosInfInterval!Date(Date(1999, 5, 4))));

  const pure nothrow bool `intersects`(in NegInfInterval!TP `interval`);
    Whether the given `interval` overlaps this `interval`.
    Parameters:

    NegInfInterval!TP `interval` | The `interval` to check for intersection with this `interval`.

    Example:

        assert(!PosInfInterval!Date(Date(1996, 1, 2)).intersects(
                    NegInfInterval!Date(Date(1996, 1, 2))));

        assert(PosInfInterval!Date(Date(1996, 1, 2)).intersects(
                    NegInfInterval!Date(Date(2000, 7, 1))));

  const Interval!TP `intersection`(in Interval!TP `interval`);
    Returns the `intersection` of two intervals
    Parameters:

    Interval!TP `interval` | The `interval` to intersect with this `interval`.

    Throws:
    DateTimeException if the two intervals do not intersect or if the given `interval` is empty.

    Example:

        assert(PosInfInterval!Date(Date(1996, 1, 2)).intersection(
                    Interval!Date(Date(1990, 7, 6), Date(2000, 8, 2))) ==
               Interval!Date(Date(1996, 1 , 2), Date(2000, 8, 2)));

        assert(PosInfInterval!Date(Date(1996, 1, 2)).intersection(
                    Interval!Date(Date(1999, 1, 12), Date(2011, 9, 17))) ==
               Interval!Date(Date(1999, 1 , 12), Date(2011, 9, 17)));

  const pure nothrow PosInfInterval `intersection`(in PosInfInterval `interval`);
    Returns the `intersection` of two intervals
    Parameters:

    PosInfInterval `interval` | The `interval` to intersect with this `interval`.

    Example:

        assert(PosInfInterval!Date(Date(1996, 1, 2)).intersection(
                    PosInfInterval!Date(Date(1990, 7, 6))) ==
               PosInfInterval!Date(Date(1996, 1 , 2)));

        assert(PosInfInterval!Date(Date(1996, 1, 2)).intersection(
                    PosInfInterval!Date(Date(1999, 1, 12))) ==
               PosInfInterval!Date(Date(1999, 1 , 12)));

  const Interval!TP `intersection`(in NegInfInterval!TP `interval`);
    Returns the `intersection` of two intervals
    Parameters:

    NegInfInterval!TP `interval` | The `interval` to intersect with this `interval`.

    Throws:
    DateTimeException if the two intervals do not intersect.

    Example:

        assert(PosInfInterval!Date(Date(1996, 1, 2)).intersection(
                    NegInfInterval!Date(Date(1999, 7, 6))) ==
               Interval!Date(Date(1996, 1 , 2), Date(1999, 7, 6)));

        assert(PosInfInterval!Date(Date(1996, 1, 2)).intersection(
                    NegInfInterval!Date(Date(2013, 1, 12))) ==
               Interval!Date(Date(1996, 1 , 2), Date(2013, 1, 12)));

  const pure bool `isAdjacent`(in Interval!TP `interval`);
    Whether the given `interval` is adjacent to this `interval`.
    Parameters:

    Interval!TP `interval` | The `interval` to check whether its adjecent to this `interval`.

    Throws:
    DateTimeException if the given `interval` is empty.

    Example:

        assert(PosInfInterval!Date(Date(1996, 1, 2)).isAdjacent(
                    Interval!Date(Date(1989, 3, 1), Date(1996, 1, 2))));

        assert(!PosInfInterval!Date(Date(1999, 1, 12)).isAdjacent(
                    Interval!Date(Date(1999, 1, 12), Date(2011, 9, 17))));

  const pure nothrow bool `isAdjacent`(in PosInfInterval `interval`);
    Whether the given `interval` is adjacent to this `interval`.
    Always returns `false` because two intervals going to positive infinity can never be adjacent to one another.
    Parameters:

    PosInfInterval `interval` | The `interval` to check whether its adjecent to this `interval`.

    Example:

        assert(!PosInfInterval!Date(Date(1996, 1, 2)).isAdjacent(
                    PosInfInterval!Date(Date(1990, 1, 7))));

        assert(!PosInfInterval!Date(Date(1996, 1, 2)).isAdjacent(
                    PosInfInterval!Date(Date(1996, 1, 2))));

  const pure nothrow bool `isAdjacent`(in NegInfInterval!TP `interval`);
    Whether the given `interval` is adjacent to this `interval`.
    Parameters:

    NegInfInterval!TP `interval` | The `interval` to check whether its adjecent to this `interval`.

    Example:

        assert(PosInfInterval!Date(Date(1996, 1, 2)).isAdjacent(
                    NegInfInterval!Date(Date(1996, 1, 2))));

        assert(!PosInfInterval!Date(Date(1996, 1, 2)).isAdjacent(
                    NegInfInterval!Date(Date(2000, 7, 1))));

  const PosInfInterval `merge`(in Interval!TP `interval`);
    Returns the union of two intervals
    Parameters:

    Interval!TP `interval` | The `interval` to `merge` with this `interval`.

    Throws:
    DateTimeException if the two intervals do not intersect and are not adjacent or if the given `interval` is empty.

    Note: There is no overload for `merge` which takes a NegInfInterval, because an `interval` going from negative infinity to positive infinity is not possible.

    Example:

        assert(PosInfInterval!Date(Date(1996, 1, 2)).merge(
                    Interval!Date(Date(1990, 7, 6), Date(2000, 8, 2))) ==
               PosInfInterval!Date(Date(1990, 7 , 6)));

        assert(PosInfInterval!Date(Date(1996, 1, 2)).merge(
                    Interval!Date(Date(1999, 1, 12), Date(2011, 9, 17))) ==
               PosInfInterval!Date(Date(1996, 1 , 2)));

  const pure nothrow PosInfInterval `merge`(in PosInfInterval `interval`);
    Returns the union of two intervals
    Parameters:

    PosInfInterval `interval` | The `interval` to `merge` with this `interval`.

    Note: There is no overload for `merge` which takes a NegInfInterval, because an `interval` going from negative infinity to positive infinity is not possible.

    Example:

        assert(PosInfInterval!Date(Date(1996, 1, 2)).merge(
                    PosInfInterval!Date(Date(1990, 7, 6))) ==
               PosInfInterval!Date(Date(1990, 7 , 6)));

        assert(PosInfInterval!Date(Date(1996, 1, 2)).merge(
                    PosInfInterval!Date(Date(1999, 1, 12))) ==
               PosInfInterval!Date(Date(1996, 1 , 2)));

  const pure PosInfInterval `span`(in Interval!TP `interval`);
    Returns an `interval` that covers from the earliest time point of two intervals up to (but not including) the latest time point of two intervals.
    Parameters:

    Interval!TP `interval` | The `interval` to create a `span` together with this `interval`.

    Throws:
    DateTimeException if the given `interval` is empty.

    Note: There is no overload for `span` which takes a NegInfInterval, because an `interval` going from negative infinity to positive infinity is not possible.

    Example:

        assert(PosInfInterval!Date(Date(1996, 1, 2)).span(
                    Interval!Date(Date(500, 8, 9), Date(1602, 1, 31))) ==
               PosInfInterval!Date(Date(500, 8, 9)));

        assert(PosInfInterval!Date(Date(1996, 1, 2)).span(
                    Interval!Date(Date(1990, 7, 6), Date(2000, 8, 2))) ==
               PosInfInterval!Date(Date(1990, 7 , 6)));

        assert(PosInfInterval!Date(Date(1996, 1, 2)).span(
                    Interval!Date(Date(1999, 1, 12), Date(2011, 9, 17))) ==
               PosInfInterval!Date(Date(1996, 1 , 2)));

  const pure nothrow PosInfInterval `span`(in PosInfInterval `interval`);
    Returns an `interval` that covers from the earliest time point of two intervals up to (but not including) the latest time point of two intervals.
    Parameters:

    PosInfInterval `interval` | The `interval` to create a `span` together with this `interval`.

    Note: There is no overload for `span` which takes a NegInfInterval, because an `interval` going from negative infinity to positive infinity is not possible.

    Example:

        assert(PosInfInterval!Date(Date(1996, 1, 2)).span(
                    PosInfInterval!Date(Date(1990, 7, 6))) ==
               PosInfInterval!Date(Date(1990, 7 , 6)));

        assert(PosInfInterval!Date(Date(1996, 1, 2)).span(
                    PosInfInterval!Date(Date(1999, 1, 12))) ==
               PosInfInterval!Date(Date(1996, 1 , 2)));

  pure nothrow void `shift`(D)(D `duration`)
  if (__traits(compiles, begin + `duration`));
    Shifts the begin of this interval forward or backwards in time by the given `duration` (a positive `duration` shifts the interval forward; a negative `duration` shifts it backward). Effectively, it does begin += `duration`.
    Parameters:

    D `duration` | The `duration` to `shift` the interval by.

    Example:

        auto interval1 = PosInfInterval!Date(Date(1996, 1, 2));
        auto interval2 = PosInfInterval!Date(Date(1996, 1, 2));

        interval1.shift(dur!"days"(50));
        assert(interval1 == PosInfInterval!Date(Date(1996, 2, 21)));

        interval2.shift(dur!"days"(-50));
        assert(interval2 == PosInfInterval!Date(Date(1995, 11, 13)));

  void `shift`(T)(T `years`, T `months` = 0, AllowDayOverflow `allowOverflow` = Yes.allowDayOverflow)
  if (isIntegral!T);
    Shifts the begin of this interval forward or backwards in time by the given number of `years` and/or `months` (a positive number of `years` and `months` shifts the interval forward; a negative number shifts it backward). It adds the `years` the given `years` and `months` to begin. It effectively calls add!"`years`"() and then add!"`months`"() on begin with the given number of `years` and `months`.
    Parameters:

    T `years` | The number of `years` to `shift` the interval by.
    T `months` | The number of `months` to `shift` the interval by.
    AllowDayOverflow `allowOverflow` | Whether the days should be allowed to overflow on begin, causing its month to increment.

    Throws:
    DateTimeException if this interval is empty or if the resulting interval would be invalid.

    Example:

        auto interval1 = PosInfInterval!Date(Date(1996, 1, 2));
        auto interval2 = PosInfInterval!Date(Date(1996, 1, 2));

        interval1.shift(dur!"days"(50));
        assert(interval1 == PosInfInterval!Date(Date(1996, 2, 21)));

        interval2.shift(dur!"days"(-50));
        assert(interval2 == PosInfInterval!Date(Date(1995, 11, 13)));

  pure nothrow void `expand`(D)(D `duration`)
  if (__traits(compiles, begin + `duration`));
    Expands the interval backwards in time. Effectively, it does begin -= `duration`.
    Parameters:

    D `duration` | The `duration` to `expand` the interval by.

    Example:

        auto interval1 = PosInfInterval!Date(Date(1996, 1, 2));
        auto interval2 = PosInfInterval!Date(Date(1996, 1, 2));

        interval1.expand(dur!"days"(2));
        assert(interval1 == PosInfInterval!Date(Date(1995, 12, 31)));

        interval2.expand(dur!"days"(-2));
        assert(interval2 == PosInfInterval!Date(Date(1996, 1, 4)));

  void `expand`(T)(T `years`, T `months` = 0, AllowDayOverflow `allowOverflow` = Yes.allowDayOverflow)
  if (isIntegral!T);
    Expands the interval forwards and/or backwards in time. Effectively, it subtracts the given number of `months`/`years` from begin.
    Parameters:

    T `years` | The number of `years` to `expand` the interval by.
    T `months` | The number of `months` to `expand` the interval by.
    AllowDayOverflow `allowOverflow` | Whether the days should be allowed to overflow on begin, causing its month to increment.

    Throws:
    DateTimeException if this interval is empty or if the resulting interval would be invalid.

    Example:

        auto interval1 = PosInfInterval!Date(Date(1996, 1, 2));
        auto interval2 = PosInfInterval!Date(Date(1996, 1, 2));

        interval1.expand(2);
        assert(interval1 == PosInfInterval!Date(Date(1994, 1, 2)));

        interval2.expand(-2);
        assert(interval2 == PosInfInterval!Date(Date(1998, 1, 2)));

  const PosInfIntervalRange!TP `fwdRange`(TP delegate(in TP) `func`, PopFirst `popFirst` = No.`popFirst`);
    Returns a range which iterates forward over the interval, starting at begin, using `func` to generate each successive time point.
    The range's front is the interval's begin. `func` is used to generate the next front when popFront is called. If `popFirst` is Yes.`popFirst`, then popFront is called before the range is returned (so that front is a time point which `func` would generate).
    If `func` ever generates a time point less than or equal to the current front of the range, then a DateTimeException will be thrown.
    There are helper functions in this module which generate common delegates to pass to `fwdRange`. Their documentation starts with "Range-generating function," to make them easily searchable.
    Parameters:

    TP delegate(in TP) `func` | The function used to generate the time points of the range over the interval.
    PopFirst `popFirst` | Whether popFront should be called on the range before returning it.

    Throws:
    DateTimeException if this interval is empty.

    Warning: `func` must be logically pure. Ideally, `func` would be a function pointer to a pure function, but forcing `func` to be pure is far too restrictive to be useful, and in order to have the ease of use of having functions which generate functions to pass to `fwdRange`, `func` must be a delegate.

    If `func` retains state which changes as it is called, then some algorithms will not work correctly, because the range's save will have failed to have really saved the range's state. To avoid such bugs, don't pass a delegate which is not logically pure to `fwdRange`. If `func` is given the same time point with two different calls, it must return the same result both times.
    Of course, none of the functions in this module have this problem, so it's only relevant for custom delegates.

    Example:

        auto interval = PosInfInterval!Date(Date(2010, 9, 1));
        auto func = delegate (in Date date) //For iterating over even-numbered days.
                    {
                        if ((date.day & 1) == 0)
                            return date + dur!"days"(2);

                        return date + dur!"days"(1);
                    };
        auto range = interval.fwdRange(func);

        //An odd day. Using Yes.popFirst would have made this Date(2010, 9, 2).
        assert(range.front == Date(2010, 9, 1));

        range.popFront();
        assert(range.front == Date(2010, 9, 2));

        range.popFront();
        assert(range.front == Date(2010, 9, 4));

        range.popFront();
        assert(range.front == Date(2010, 9, 6));

        range.popFront();
        assert(range.front == Date(2010, 9, 8));

        range.popFront();
        assert(!range.empty);

  const nothrow string `toString`();
    Converts this interval to a string.
struct `NegInfInterval`(TP);
  Represents an interval of time which has negative infinity as its starting point.
  Any ranges which iterate over a `NegInfInterval` are infinite. So, the main purpose of using `NegInfInterval` is to create an infinite range which starts at negative infinity and goes to a fixed end point. Iterate over it in reverse.
  pure nothrow this(in TP `end`);
    Parameters:

    TP `end` | The time point which ends the interval.

    Example:

        auto interval = PosInfInterval!Date(Date(1996, 1, 2));

  pure nothrow ref NegInfInterval `opAssign`(ref const NegInfInterval `rhs`);
    Parameters:

    NegInfInterval `rhs` | The NegInfInterval to assign to this one.

  pure nothrow ref NegInfInterval `opAssign`(NegInfInterval `rhs`);
    Parameters:

    NegInfInterval `rhs` | The NegInfInterval to assign to this one.

  const pure nothrow @property TP `end`();
    The `end` point of the interval. It is excluded from the interval.

    Example:

        assert(NegInfInterval!Date(Date(2012, 3, 1)).end == Date(2012, 3, 1));

  pure nothrow @property void `end`(TP `timePoint`);
    The `end` point of the interval. It is excluded from the interval.
    Parameters:

    TP `timePoint` | The time point to set `end` to.

  enum bool `empty`;
    Whether the interval's length is 0. Always returns `false`.

    Example:

        assert(!NegInfInterval!Date(Date(1996, 1, 2)).empty);

  const pure nothrow bool `contains`(TP `timePoint`);
    Whether the given time point is within this interval.
    Parameters:

    TP `timePoint` | The time point to check for inclusion in this interval.

    Example:

        assert(NegInfInterval!Date(Date(2012, 3, 1)).contains(Date(1994, 12, 24)));
        assert(NegInfInterval!Date(Date(2012, 3, 1)).contains(Date(2000, 1, 5)));
        assert(!NegInfInterval!Date(Date(2012, 3, 1)).contains(Date(2012, 3, 1)));

  const pure bool `contains`(in Interval!TP `interval`);
    Whether the given `interval` is completely within this `interval`.
    Parameters:

    Interval!TP `interval` | The `interval` to check for inclusion in this `interval`.

    Throws:
    DateTimeException if the given `interval` is empty.

    Example:

        assert(NegInfInterval!Date(Date(2012, 3, 1)).contains(
                    Interval!Date(Date(1990, 7, 6), Date(2000, 8, 2))));

        assert(NegInfInterval!Date(Date(2012, 3, 1)).contains(
                    Interval!Date(Date(1999, 1, 12), Date(2011, 9, 17))));

        assert(!NegInfInterval!Date(Date(2012, 3, 1)).contains(
                    Interval!Date(Date(1998, 2, 28), Date(2013, 5, 1))));

  const pure nothrow bool `contains`(in PosInfInterval!TP `interval`);
    Whether the given `interval` is completely within this `interval`.
    Always returns `false` because an `interval` beginning at negative infinity can never contain an `interval` going to positive infinity.
    Parameters:

    PosInfInterval!TP `interval` | The `interval` to check for inclusion in this `interval`.

    Example:

        assert(!NegInfInterval!Date(Date(2012, 3, 1)).contains(
                    PosInfInterval!Date(Date(1999, 5, 4))));

  const pure nothrow bool `contains`(in NegInfInterval `interval`);
    Whether the given `interval` is completely within this `interval`.
    Parameters:

    NegInfInterval `interval` | The `interval` to check for inclusion in this `interval`.

    Example:

        assert(NegInfInterval!Date(Date(2012, 3, 1)).contains(
                    NegInfInterval!Date(Date(1996, 5, 4))));

        assert(!NegInfInterval!Date(Date(2012, 3, 1)).contains(
                    NegInfInterval!Date(Date(2013, 7, 9))));

  const pure nothrow bool `isBefore`(in TP `timePoint`);
    Whether this interval is before the given time point.
    Parameters:

    TP `timePoint` | The time point to check whether this interval is before it.

    Example:

        assert(!NegInfInterval!Date(Date(2012, 3, 1)).isBefore(Date(1994, 12, 24)));
        assert(!NegInfInterval!Date(Date(2012, 3, 1)).isBefore(Date(2000, 1, 5)));
        assert(NegInfInterval!Date(Date(2012, 3, 1)).isBefore(Date(2012, 3, 1)));

  const pure bool `isBefore`(in Interval!TP `interval`);
    Whether this `interval` is before the given `interval` and does not intersect it.
    Parameters:

    Interval!TP `interval` | The `interval` to check for against this `interval`.

    Throws:
    DateTimeException if the given `interval` is empty

    Example:

        assert(!NegInfInterval!Date(Date(2012, 3, 1)).isBefore(
                    Interval!Date(Date(1990, 7, 6), Date(2000, 8, 2))));

        assert(!NegInfInterval!Date(Date(2012, 3, 1)).isBefore(
                    Interval!Date(Date(1999, 1, 12), Date(2011, 9, 17))));

        assert(NegInfInterval!Date(Date(2012, 3, 1)).isBefore(
                    Interval!Date(Date(2022, 10, 19), Date(2027, 6, 3))));

  const pure nothrow bool `isBefore`(in PosInfInterval!TP `interval`);
    Whether this `interval` is before the given `interval` and does not intersect it.
    Parameters:

    PosInfInterval!TP `interval` | The `interval` to check for against this `interval`.

    Example:

        assert(!NegInfInterval!Date(Date(2012, 3, 1)).isBefore(
                    PosInfInterval!Date(Date(1999, 5, 4))));

        assert(NegInfInterval!Date(Date(2012, 3, 1)).isBefore(
                    PosInfInterval!Date(Date(2012, 3, 1))));

  const pure nothrow bool `isBefore`(in NegInfInterval `interval`);
    Whether this `interval` is before the given `interval` and does not intersect it.
    Always returns `false` because an `interval` beginning at negative infinity can never be before another `interval` beginning at negative infinity.
    Parameters:

    NegInfInterval `interval` | The `interval` to check for against this `interval`.

    Example:

        assert(!NegInfInterval!Date(Date(2012, 3, 1)).isBefore(
                    NegInfInterval!Date(Date(1996, 5, 4))));

        assert(!NegInfInterval!Date(Date(2012, 3, 1)).isBefore(
                    NegInfInterval!Date(Date(2013, 7, 9))));

  const pure nothrow bool `isAfter`(in TP `timePoint`);
    Whether this interval is after the given time point.
    Always returns `false` because an interval beginning at negative infinity can never be after any time point.
    Parameters:

    TP `timePoint` | The time point to check whether this interval is after it.

    Example:

        assert(!NegInfInterval!Date(Date(2012, 3, 1)).isAfter(Date(1994, 12, 24)));
        assert(!NegInfInterval!Date(Date(2012, 3, 1)).isAfter(Date(2000, 1, 5)));
        assert(!NegInfInterval!Date(Date(2012, 3, 1)).isAfter(Date(2012, 3, 1)));

  const pure bool `isAfter`(in Interval!TP `interval`);
    Whether this `interval` is after the given `interval` and does not intersect it.
    Always returns `false` (unless the given `interval` is empty) because an `interval` beginning at negative infinity can never be after any other `interval`.
    Parameters:

    Interval!TP `interval` | The `interval` to check against this `interval`.

    Throws:
    DateTimeException if the given `interval` is empty.

    Example:

        assert(!NegInfInterval!Date(Date(2012, 3, 1)).isAfter(
                    Interval!Date(Date(1990, 7, 6), Date(2000, 8, 2))));

        assert(!NegInfInterval!Date(Date(2012, 3, 1)).isAfter(
                    Interval!Date(Date(1999, 1, 12), Date(2011, 9, 17))));

        assert(!NegInfInterval!Date(Date(2012, 3, 1)).isAfter(
                    Interval!Date(Date(2022, 10, 19), Date(2027, 6, 3))));

  const pure nothrow bool `isAfter`(in PosInfInterval!TP `interval`);
    Whether this `interval` is after the given `interval` and does not intersect it.
    Always returns `false` because an `interval` beginning at negative infinity can never be after any other `interval`.
    Parameters:

    PosInfInterval!TP `interval` | The `interval` to check against this `interval`.

    Example:

        assert(!NegInfInterval!Date(Date(2012, 3, 1)).isAfter(
                    PosInfInterval!Date(Date(1999, 5, 4))));

        assert(!NegInfInterval!Date(Date(2012, 3, 1)).isAfter(
                    PosInfInterval!Date(Date(2012, 3, 1))));

  const pure nothrow bool `isAfter`(in NegInfInterval `interval`);
    Whether this `interval` is after the given `interval` and does not intersect it.
    Always returns `false` because an `interval` beginning at negative infinity can never be after any other `interval`.
    Parameters:

    NegInfInterval `interval` | The `interval` to check against this `interval`.

    Example:

        assert(!NegInfInterval!Date(Date(2012, 3, 1)).isAfter(
                    NegInfInterval!Date(Date(1996, 5, 4))));

        assert(!NegInfInterval!Date(Date(2012, 3, 1)).isAfter(
                    NegInfInterval!Date(Date(2013, 7, 9))));

  const pure bool `intersects`(in Interval!TP `interval`);
    Whether the given `interval` overlaps this `interval`.
    Parameters:

    Interval!TP `interval` | The `interval` to check for intersection with this `interval`.

    Throws:
    DateTimeException if the given `interval` is empty.

    Example:

        assert(NegInfInterval!Date(Date(2012, 3, 1)).intersects(
                    Interval!Date(Date(1990, 7, 6), Date(2000, 8, 2))));

        assert(NegInfInterval!Date(Date(2012, 3, 1)).intersects(
                    Interval!Date(Date(1999, 1, 12), Date(2011, 9, 17))));

        assert(!NegInfInterval!Date(Date(2012, 3, 1)).intersects(
                    Interval!Date(Date(2022, 10, 19), Date(2027, 6, 3))));

  const pure nothrow bool `intersects`(in PosInfInterval!TP `interval`);
    Whether the given `interval` overlaps this `interval`.
    Parameters:

    PosInfInterval!TP `interval` | The `interval` to check for intersection with this `interval`.

    Example:

        assert(NegInfInterval!Date(Date(2012, 3, 1)).intersects(
                    PosInfInterval!Date(Date(1999, 5, 4))));

        assert(!NegInfInterval!Date(Date(2012, 3, 1)).intersects(
                    PosInfInterval!Date(Date(2012, 3, 1))));

  const pure nothrow bool `intersects`(in NegInfInterval!TP `interval`);
    Whether the given `interval` overlaps this `interval`.
    Always returns `true` because two intervals beginning at negative infinity always overlap.
    Parameters:

    NegInfInterval!TP `interval` | The `interval` to check for intersection with this `interval`.

    Example:

        assert(NegInfInterval!Date(Date(2012, 3, 1)).intersects(
                    NegInfInterval!Date(Date(1996, 5, 4))));

        assert(NegInfInterval!Date(Date(2012, 3, 1)).intersects(
                    NegInfInterval!Date(Date(2013, 7, 9))));

  const Interval!TP `intersection`(in Interval!TP `interval`);
    Returns the `intersection` of two intervals
    Parameters:

    Interval!TP `interval` | The `interval` to intersect with this `interval`.

    Throws:
    DateTimeException if the two intervals do not intersect or if the given `interval` is empty.

    Example:

        assert(NegInfInterval!Date(Date(2012, 3, 1)).intersection(
                    Interval!Date(Date(1990, 7, 6), Date(2000, 8, 2))) ==
               Interval!Date(Date(1990, 7 , 6), Date(2000, 8, 2)));

        assert(NegInfInterval!Date(Date(2012, 3, 1)).intersection(
                    Interval!Date(Date(1999, 1, 12), Date(2015, 9, 2))) ==
               Interval!Date(Date(1999, 1 , 12), Date(2012, 3, 1)));

  const Interval!TP `intersection`(in PosInfInterval!TP `interval`);
    Returns the `intersection` of two intervals
    Parameters:

    PosInfInterval!TP `interval` | The `interval` to intersect with this `interval`.

    Throws:
    DateTimeException if the two intervals do not intersect.

    Example:

        assert(NegInfInterval!Date(Date(2012, 3, 1)).intersection(
                    PosInfInterval!Date(Date(1990, 7, 6))) ==
               Interval!Date(Date(1990, 7 , 6), Date(2012, 3, 1)));

        assert(NegInfInterval!Date(Date(2012, 3, 1)).intersection(
                    PosInfInterval!Date(Date(1999, 1, 12))) ==
               Interval!Date(Date(1999, 1 , 12), Date(2012, 3, 1)));

  const nothrow NegInfInterval `intersection`(in NegInfInterval `interval`);
    Returns the `intersection` of two intervals
    Parameters:

    NegInfInterval `interval` | The `interval` to intersect with this `interval`.

    Example:

        assert(NegInfInterval!Date(Date(2012, 3, 1)).intersection(
                    NegInfInterval!Date(Date(1999, 7, 6))) ==
               NegInfInterval!Date(Date(1999, 7 , 6)));

        assert(NegInfInterval!Date(Date(2012, 3, 1)).intersection(
                    NegInfInterval!Date(Date(2013, 1, 12))) ==
               NegInfInterval!Date(Date(2012, 3 , 1)));

  const pure bool `isAdjacent`(in Interval!TP `interval`);
    Whether the given `interval` is adjacent to this `interval`.
    Parameters:

    Interval!TP `interval` | The `interval` to check whether its adjecent to this `interval`.

    Throws:
    DateTimeException if the given `interval` is empty.

    Example:

        assert(!NegInfInterval!Date(Date(2012, 3, 1)).isAdjacent(
                    Interval!Date(Date(1990, 7, 6), Date(2000, 8, 2))));

        assert(!NegInfInterval!Date(Date(2012, 3, 1)).isAdjacent(
                    Interval!Date(Date(1999, 1, 12), Date(2012, 3, 1))));

        assert(NegInfInterval!Date(Date(2012, 3, 1)).isAdjacent(
                    Interval!Date(Date(2012, 3, 1), Date(2019, 2, 2))));

        assert(!NegInfInterval!Date(Date(2012, 3, 1)).isAdjacent(
                    Interval!Date(Date(2022, 10, 19), Date(2027, 6, 3))));

  const pure nothrow bool `isAdjacent`(in PosInfInterval!TP `interval`);
    Whether the given `interval` is adjacent to this `interval`.
    Parameters:

    PosInfInterval!TP `interval` | The `interval` to check whether its adjecent to this `interval`.

    Example:

        assert(!NegInfInterval!Date(Date(2012, 3, 1)).isAdjacent(
                    PosInfInterval!Date(Date(1999, 5, 4))));

        assert(NegInfInterval!Date(Date(2012, 3, 1)).isAdjacent(
                    PosInfInterval!Date(Date(2012, 3, 1))));

  const pure nothrow bool `isAdjacent`(in NegInfInterval `interval`);
    Whether the given `interval` is adjacent to this `interval`.
    Always returns `false` because two intervals beginning at negative infinity can never be adjacent to one another.
    Parameters:

    NegInfInterval `interval` | The `interval` to check whether its adjecent to this `interval`.

    Example:

        assert(!NegInfInterval!Date(Date(2012, 3, 1)).isAdjacent(
                    NegInfInterval!Date(Date(1996, 5, 4))));

        assert(!NegInfInterval!Date(Date(2012, 3, 1)).isAdjacent(
                    NegInfInterval!Date(Date(2012, 3, 1))));

  const NegInfInterval `merge`(in Interval!TP `interval`);
    Returns the union of two intervals
    Parameters:

    Interval!TP `interval` | The `interval` to `merge` with this `interval`.

    Throws:
    DateTimeException if the two intervals do not intersect and are not adjacent or if the given `interval` is empty.

    Note: There is no overload for `merge` which takes a PosInfInterval, because an `interval` going from negative infinity to positive infinity is not possible.

    Example:

        assert(NegInfInterval!Date(Date(2012, 3, 1)).merge(
                    Interval!Date(Date(1990, 7, 6), Date(2000, 8, 2))) ==
               NegInfInterval!Date(Date(2012, 3 , 1)));

        assert(NegInfInterval!Date(Date(2012, 3, 1)).merge(
                    Interval!Date(Date(1999, 1, 12), Date(2015, 9, 2))) ==
               NegInfInterval!Date(Date(2015, 9 , 2)));

  const pure nothrow NegInfInterval `merge`(in NegInfInterval `interval`);
    Returns the union of two intervals
    Parameters:

    NegInfInterval `interval` | The `interval` to `merge` with this `interval`.

    Note: There is no overload for `merge` which takes a PosInfInterval, because an `interval` going from negative infinity to positive infinity is not possible.

    Example:

        assert(NegInfInterval!Date(Date(2012, 3, 1)).merge(
                    NegInfInterval!Date(Date(1999, 7, 6))) ==
               NegInfInterval!Date(Date(2012, 3 , 1)));

        assert(NegInfInterval!Date(Date(2012, 3, 1)).merge(
                    NegInfInterval!Date(Date(2013, 1, 12))) ==
               NegInfInterval!Date(Date(2013, 1 , 12)));

  const pure NegInfInterval `span`(in Interval!TP `interval`);
    Returns an `interval` that covers from the earliest time point of two intervals up to (but not including) the latest time point of two intervals.
    Parameters:

    Interval!TP `interval` | The `interval` to create a `span` together with this `interval`.

    Throws:
    DateTimeException if the given `interval` is empty.

    Note: There is no overload for `span` which takes a PosInfInterval, because an `interval` going from negative infinity to positive infinity is not possible.

    Example:

        assert(NegInfInterval!Date(Date(2012, 3, 1)).span(
                    Interval!Date(Date(1990, 7, 6), Date(2000, 8, 2))) ==
               NegInfInterval!Date(Date(2012, 3 , 1)));

        assert(NegInfInterval!Date(Date(2012, 3, 1)).span(
                    Interval!Date(Date(1999, 1, 12), Date(2015, 9, 2))) ==
               NegInfInterval!Date(Date(2015, 9 , 2)));

        assert(NegInfInterval!Date(Date(1600, 1, 7)).span(
                    Interval!Date(Date(2012, 3, 11), Date(2017, 7, 1))) ==
               NegInfInterval!Date(Date(2017, 7 , 1)));

  const pure nothrow NegInfInterval `span`(in NegInfInterval `interval`);
    Returns an `interval` that covers from the earliest time point of two intervals up to (but not including) the latest time point of two intervals.
    Parameters:

    NegInfInterval `interval` | The `interval` to create a `span` together with this `interval`.

    Note: There is no overload for `span` which takes a PosInfInterval, because an `interval` going from negative infinity to positive infinity is not possible.

    Example:

        assert(NegInfInterval!Date(Date(2012, 3, 1)).span(
                    NegInfInterval!Date(Date(1999, 7, 6))) ==
               NegInfInterval!Date(Date(2012, 3 , 1)));

        assert(NegInfInterval!Date(Date(2012, 3, 1)).span(
                    NegInfInterval!Date(Date(2013, 1, 12))) ==
               NegInfInterval!Date(Date(2013, 1 , 12)));

  pure nothrow void `shift`(D)(D `duration`)
  if (__traits(compiles, end + `duration`));
    Shifts the end of this interval forward or backwards in time by the given `duration` (a positive `duration` shifts the interval forward; a negative `duration` shifts it backward). Effectively, it does end += `duration`.
    Parameters:

    D `duration` | The `duration` to `shift` the interval by.

    Example:

        auto interval1 = NegInfInterval!Date(Date(2012, 4, 5));
        auto interval2 = NegInfInterval!Date(Date(2012, 4, 5));

        interval1.shift(dur!"days"(50));
        assert(interval1 == NegInfInterval!Date(Date(2012, 5, 25)));

        interval2.shift(dur!"days"(-50));
        assert(interval2 == NegInfInterval!Date( Date(2012, 2, 15)));

  void `shift`(T)(T `years`, T `months` = 0, AllowDayOverflow `allowOverflow` = Yes.allowDayOverflow)
  if (isIntegral!T);
    Shifts the end of this interval forward or backwards in time by the given number of `years` and/or `months` (a positive number of `years` and `months` shifts the interval forward; a negative number shifts it backward). It adds the `years` the given `years` and `months` to end. It effectively calls add!"`years`"() and then add!"`months`"() on end with the given number of `years` and `months`.
    Parameters:

    T `years` | The number of `years` to `shift` the interval by.
    T `months` | The number of `months` to `shift` the interval by.
    AllowDayOverflow `allowOverflow` | Whether the days should be allowed to overflow on end, causing its month to increment.

    Throws:
    DateTimeException if empty is `true` or if the resulting interval would be invalid.

    Example:

        auto interval1 = NegInfInterval!Date(Date(2012, 3, 1));
        auto interval2 = NegInfInterval!Date(Date(2012, 3, 1));

        interval1.shift(2);
        assert(interval1 == NegInfInterval!Date(Date(2014, 3, 1)));

        interval2.shift(-2);
        assert(interval2 == NegInfInterval!Date(Date(2010, 3, 1)));

  pure nothrow void `expand`(D)(D `duration`)
  if (__traits(compiles, end + `duration`));
    Expands the interval forwards in time. Effectively, it does end += `duration`.
    Parameters:

    D `duration` | The `duration` to `expand` the interval by.

    Example:

        auto interval1 = NegInfInterval!Date(Date(2012, 3, 1));
        auto interval2 = NegInfInterval!Date(Date(2012, 3, 1));

        interval1.expand(dur!"days"(2));
        assert(interval1 == NegInfInterval!Date(Date(2012, 3, 3)));

        interval2.expand(dur!"days"(-2));
        assert(interval2 == NegInfInterval!Date(Date(2012, 2, 28)));

  void `expand`(T)(T `years`, T `months` = 0, AllowDayOverflow `allowOverflow` = Yes.allowDayOverflow)
  if (isIntegral!T);
    Expands the interval forwards and/or backwards in time. Effectively, it adds the given number of `months`/`years` to end.
    Parameters:

    T `years` | The number of `years` to `expand` the interval by.
    T `months` | The number of `months` to `expand` the interval by.
    AllowDayOverflow `allowOverflow` | Whether the days should be allowed to overflow on end, causing their month to increment.

    Throws:
    DateTimeException if empty is `true` or if the resulting interval would be invalid.

    Example:

        auto interval1 = NegInfInterval!Date(Date(2012, 3, 1));
        auto interval2 = NegInfInterval!Date(Date(2012, 3, 1));

        interval1.expand(2);
        assert(interval1 == NegInfInterval!Date(Date(2014, 3, 1)));

        interval2.expand(-2);
        assert(interval2 == NegInfInterval!Date(Date(2010, 3, 1)));

  const NegInfIntervalRange!TP `bwdRange`(TP delegate(in TP) `func`, PopFirst `popFirst` = No.`popFirst`);
    Returns a range which iterates backwards over the interval, starting at end, using `func` to generate each successive time point.
    The range's front is the interval's end. `func` is used to generate the next front when popFront is called. If `popFirst` is Yes.`popFirst`, then popFront is called before the range is returned (so that front is a time point which `func` would generate).
    If `func` ever generates a time point greater than or equal to the current front of the range, then a DateTimeException will be thrown.
    There are helper functions in this module which generate common delegates to pass to `bwdRange`. Their documentation starts with "Range-generating function," to make them easily searchable.
    Parameters:

    TP delegate(in TP) `func` | The function used to generate the time points of the range over the interval.
    PopFirst `popFirst` | Whether popFront should be called on the range before returning it.

    Throws:
    DateTimeException if this interval is empty.

    Warning: `func` must be logically pure. Ideally, `func` would be a function pointer to a pure function, but forcing `func` to be pure is far too restrictive to be useful, and in order to have the ease of use of having functions which generate functions to pass to fwdRange, `func` must be a delegate.

    If `func` retains state which changes as it is called, then some algorithms will not work correctly, because the range's save will have failed to have really saved the range's state. To avoid such bugs, don't pass a delegate which is not logically pure to fwdRange. If `func` is given the same time point with two different calls, it must return the same result both times.
    Of course, none of the functions in this module have this problem, so it's only relevant for custom delegates.

    Example:

        auto interval = NegInfInterval!Date(Date(2010, 9, 9));
        auto func = delegate (in Date date) //For iterating over even-numbered days.
                    {
                        if ((date.day & 1) == 0)
                            return date - dur!"days"(2);

                        return date - dur!"days"(1);
                    };
        auto range = interval.bwdRange(func);

        assert(range.front == Date(2010, 9, 9)); //An odd day. Using Yes.popFirst would have made this Date(2010, 9, 8).

        range.popFront();
        assert(range.front == Date(2010, 9, 8));

        range.popFront();
        assert(range.front == Date(2010, 9, 6));

        range.popFront();
        assert(range.front == Date(2010, 9, 4));

        range.popFront();
        assert(range.front == Date(2010, 9, 2));

        range.popFront();
        assert(!range.empty);

  const nothrow string `toString`();
    Converts this interval to a string.
nothrow TP delegate(in TP) `everyDayOfWeek`(TP, Direction dir = Direction.fwd)(DayOfWeek `dayOfWeek`)
if (isTimePoint!TP && (dir == Direction.fwd || dir == Direction.bwd) && __traits(hasMember, TP, "`dayOfWeek`") && !__traits(isStaticFunction, TP.`dayOfWeek`) && is(typeof(TP.`dayOfWeek`) == DayOfWeek));
  Range-generating function.
  Returns a delegate which returns the next time point with the given DayOfWeek in a range.
  Using this delegate allows iteration over successive time points which are all the same day of the week. e.g. passing DayOfWeek.mon to `everyDayOfWeek` would result in a delegate which could be used to iterate over all of the Mondays in a range.
  Parameters:

  dir | The direction to iterate in. If passing the return value to fwdRange, use Direction.fwd. If passing it to bwdRange, use Direction.bwd.
  DayOfWeek `dayOfWeek` | The week that each time point in the range will be.

TP delegate(in TP) `everyMonth`(TP, Direction dir = Direction.fwd)(int `month`)
if (isTimePoint!TP && (dir == Direction.fwd || dir == Direction.bwd) && __traits(hasMember, TP, "`month`") && !__traits(isStaticFunction, TP.`month`) && is(typeof(TP.`month`) == Month));
  Range-generating function.
  Returns a delegate which returns the next time point with the given `month` which would be reached by adding months to the given time point.
  So, using this delegate allows iteration over successive time points which are in the same `month` but different years. For example, iterate over each successive December 25th in an interval by starting with a date which had the 25th as its day and passed Month.dec to `everyMonth` to create the delegate.
  Since it wouldn't really make sense to be iterating over a specific `month` and end up with some of the time points in the succeeding `month` or two years after the previous time point, No.allowDayOverflow is always used when calculating the next time point.
  Parameters:

  dir | The direction to iterate in. If passing the return value to fwdRange, use Direction.fwd. If passing it to bwdRange, use Direction.bwd.
  int `month` | The `month` that each time point in the range will be in.

nothrow TP delegate(in TP) `everyDuration`(TP, Direction dir = Direction.fwd, D)(D `duration`)
if (isTimePoint!TP && __traits(compiles, TP.init + `duration`) && (dir == Direction.fwd || dir == Direction.bwd));
  Range-generating function.
  Returns a delegate which returns the next time point which is the given `duration` later.
  Using this delegate allows iteration over successive time points which are apart by the given `duration` e.g. passing dur!"days"(3) to `everyDuration` would result in a delegate which could be used to iterate over a range of days which are each 3 days apart.
  Parameters:

  dir | The direction to iterate in. If passing the return value to fwdRange, use Direction.fwd. If passing it to bwdRange, use Direction.bwd.
  D `duration` | The `duration` which separates each successive time point in the range.

nothrow TP delegate(in TP) `everyDuration`(TP, Direction dir = Direction.fwd, D)(int `years`, int `months` = 0, AllowDayOverflow `allowOverflow` = Yes.allowDayOverflow, D `duration` = dur!"days"(0))
if (isTimePoint!TP && __traits(compiles, TP.init + `duration`) && __traits(compiles, TP.init.add!"`years`"(`years`)) && __traits(compiles, TP.init.add!"`months`"(`months`)) && (dir == Direction.fwd || dir == Direction.bwd));
  Range-generating function.
  Returns a delegate which returns the next time point which is the given number of `years`, month, and `duration` later.
  The difference between this version of `everyDuration` and the version which just takes a core.time.Duration is that this one also takes the number of `years` and `months` (along with an AllowDayOverflow to indicate whether adding `years` and `months` should allow the days to overflow).
  Note that if iterating forward, add!"`years`"() is called on the given time point, then add!"`months`"(), and finally the `duration` is added to it. However, if iterating backwards, the `duration` is added first, then add!"`months`"() is called, and finally add!"`years`"() is called. That way, going backwards generates close to the same time points that iterating forward does, but since adding `years` and `months` is not entirely reversible (due to possible day overflow, regardless of whether Yes.allowDayOverflow or No.allowDayOverflow is used), it can't be guaranteed that iterating backwards will give the same time points as iterating forward would have (even assuming that the end of the range is a time point which would be returned by the delegate when iterating forward from begin).
  Parameters:

  dir | The direction to iterate in. If passing the return value to fwdRange, use Direction.fwd. If passing it to bwdRange, use Direction.bwd.
  int `years` | The number of `years` to add to the time point passed to the delegate.
  int `months` | The number of `months` to add to the time point passed to the delegate.
  AllowDayOverflow `allowOverflow` | Whether the days should be allowed to overflow on begin and end, causing their month to increment.
  D `duration` | The `duration` to add to the time point passed to the delegate.

struct `IntervalRange`(TP, Direction dir) if (isTimePoint!TP && dir != Direction.both);
  A range over an Interval.
  `IntervalRange` is only ever constructed by Interval. However, when it is constructed, it is given a function, func, which is used to generate the time points which are iterated over. func takes a time point and returns a time point of the same type. For instance, to iterate over all of the days in the interval Interval!Date, pass a function to Interval's fwdRange where that function took a Date and returned a Date which was one day later. That function would then be used by `IntervalRange`'s popFront to iterate over the Dates in the interval.
  If dir == Direction.fwd, then a range iterates forward in time, whereas if dir == Direction.bwd, then it iterates backwards in time. So, if dir == Direction.fwd then front == interval.begin, whereas if dir == Direction.bwd then front == interval.end. func must generate a time point going in the proper direction of iteration, or a DateTimeException will be thrown. So, to iterate forward in time, the time point that func generates must be later in time than the one passed to it. If it's either identical or earlier in time, then a DateTimeException will be thrown. To iterate backwards, then the generated time point must be before the time point which was passed in.
  If the generated time point is ever passed the edge of the range in the proper direction, then the edge of that range will be used instead. So, if iterating forward, and the generated time point is past the interval's end, then front becomes end. If iterating backwards, and the generated time point is before begin, then front becomes begin. In either case, the range would then be empty.
  Also note that while normally the begin of an interval is included in it and its end is excluded from it, if dir == Direction.bwd, then begin is treated as excluded and end is treated as included. This allows for the same behavior in both directions. This works because none of Interval's functions which care about whether begin or end is included or excluded are ever called by `IntervalRange`. interval returns a normal interval, regardless of whether dir == Direction.fwd or if dir == Direction.bwd, so any Interval functions which are called on it which care about whether begin or end are included or excluded will treat begin as included and end as excluded.
  pure nothrow ref IntervalRange `opAssign`(ref IntervalRange `rhs`);
  pure nothrow ref IntervalRange `opAssign`(IntervalRange `rhs`);
    Parameters:

    IntervalRange `rhs` | The IntervalRange to assign to this one.

  const pure nothrow @property bool `empty`();
    Whether this IntervalRange is `empty`.
  const pure @property TP `front`();
    The first time point in the range.
    Throws:
    DateTimeException if the range is empty.
  void `popFront`();
    Pops front from the range, using func to generate the next time point in the range. If the generated time point is beyond the edge of the range, then front is set to that edge, and the range is then empty. So, if iterating forwards, and the generated time point is greater than the interval's end, then front is set to end. If iterating backwards, and the generated time point is less than the interval's begin, then front is set to begin.
    Throws:
    DateTimeException if the range is empty or if the generated time point is in the wrong direction (i.e. if iterating forward and the generated time point is before front, or if iterating backwards and the generated time point is after front).
  pure nothrow @property IntervalRange `save`();
    Returns a copy of this.
  const pure nothrow @property Interval!TP `interval`();
    The `interval` that this IntervalRange currently covers.
  pure nothrow @property TP delegate(in TP) `func`();
    The function used to generate the next time point in the range.
  const pure nothrow @property Direction `direction`();
    The Direction that this range iterates in.
struct `PosInfIntervalRange`(TP) if (isTimePoint!TP);
  A range over a PosInfInterval. It is an infinite range.
  `PosInfIntervalRange` is only ever constructed by PosInfInterval. However, when it is constructed, it is given a function, func, which is used to generate the time points which are iterated over. func takes a time point and returns a time point of the same type. For instance, to iterate over all of the days in the interval PosInfInterval!Date, pass a function to PosInfInterval's fwdRange where that function took a Date and returned a Date which was one day later. That function would then be used by `PosInfIntervalRange`'s popFront to iterate over the Dates in the interval - though obviously, since the range is infinite, use a function such as std.range.take with it rather than iterating over all of the dates.
  As the interval goes to positive infinity, the range is always iterated over forwards, never backwards. func must generate a time point going in the proper direction of iteration, or a DateTimeException will be thrown. So, the time points that func generates must be later in time than the one passed to it. If it's either identical or earlier in time, then a DateTimeException will be thrown.
  pure nothrow ref PosInfIntervalRange `opAssign`(ref PosInfIntervalRange `rhs`);
  pure nothrow ref PosInfIntervalRange `opAssign`(PosInfIntervalRange `rhs`);
    Parameters:

    PosInfIntervalRange `rhs` | The PosInfIntervalRange to assign to this one.

  enum bool `empty`;
    This is an infinite range, so it is never `empty`.
  const pure nothrow @property TP `front`();
    The first time point in the range.
  void `popFront`();
    Pops front from the range, using func to generate the next time point in the range.
    Throws:
    DateTimeException if the generated time point is less than front.
  pure nothrow @property PosInfIntervalRange `save`();
    Returns a copy of this.
  const pure nothrow @property PosInfInterval!TP `interval`();
    The `interval` that this range currently covers.
  pure nothrow @property TP delegate(in TP) `func`();
    The function used to generate the next time point in the range.
struct `NegInfIntervalRange`(TP) if (isTimePoint!TP);
  A range over a NegInfInterval. It is an infinite range.
  `NegInfIntervalRange` is only ever constructed by NegInfInterval. However, when it is constructed, it is given a function, func, which is used to generate the time points which are iterated over. func takes a time point and returns a time point of the same type. For instance, to iterate over all of the days in the interval NegInfInterval!Date, pass a function to NegInfInterval's bwdRange where that function took a Date and returned a Date which was one day earlier. That function would then be used by `NegInfIntervalRange`'s popFront to iterate over the Dates in the interval - though obviously, since the range is infinite, use a function such as std.range.take with it rather than iterating over all of the dates.
  As the interval goes to negative infinity, the range is always iterated over backwards, never forwards. func must generate a time point going in the proper direction of iteration, or a DateTimeException will be thrown. So, the time points that func generates must be earlier in time than the one passed to it. If it's either identical or later in time, then a DateTimeException will be thrown.
  Also note that while normally the end of an interval is excluded from it, `NegInfIntervalRange` treats it as if it were included. This allows for the same behavior as with PosInfIntervalRange. This works because none of NegInfInterval's functions which care about whether end is included or excluded are ever called by `NegInfIntervalRange`. interval returns a normal interval, so any NegInfInterval functions which are called on it which care about whether end is included or excluded will treat end as excluded.
  pure nothrow ref NegInfIntervalRange `opAssign`(ref NegInfIntervalRange `rhs`);
  pure nothrow ref NegInfIntervalRange `opAssign`(NegInfIntervalRange `rhs`);
    Parameters:

    NegInfIntervalRange `rhs` | The NegInfIntervalRange to assign to this one.

  enum bool `empty`;
    This is an infinite range, so it is never `empty`.
  const pure nothrow @property TP `front`();
    The first time point in the range.
  void `popFront`();
    Pops front from the range, using func to generate the next time point in the range.
    Throws:
    DateTimeException if the generated time point is greater than front.
  pure nothrow @property NegInfIntervalRange `save`();
    Returns a copy of this.
  const pure nothrow @property NegInfInterval!TP `interval`();
    The `interval` that this range currently covers.
  pure nothrow @property TP delegate(in TP) `func`();
    The function used to generate the next time point in the range.
abstract class `TimeZone`;
  Represents a time zone. It is used with SysTime to indicate the time zone of a SysTime.
  const nothrow @property @safe string `name`();
    The `name` of the time zone per the TZ Database. This is the `name` used to get a TimeZone by `name` with TimeZone.getTimeZone.
    See Also:
    Wikipedia entry on TZ Database
    List of Time Zones
  const nothrow @property @safe string `stdName`();
    Typically, the abbreviation (generally 3 or 4 letters) for the time zone when DST is not in effect (e.g. PST). It is not necessarily unique.
    However, on Windows, it may be the unabbreviated name (e.g. Pacific Standard Time). Regardless, it is not the same as name.
  const nothrow @property @safe string `dstName`();
    Typically, the abbreviation (generally 3 or 4 letters) for the time zone when DST is in effect (e.g. PDT). It is not necessarily unique.
    However, on Windows, it may be the unabbreviated name (e.g. Pacific Daylight Time). Regardless, it is not the same as name.
  abstract const nothrow @property @safe bool `hasDST`();
    Whether this time zone has Daylight Savings Time at any point in time. Note that for some time zone types it may not have DST for current dates but will still return `true` for `hasDST` because the time zone did at some point have DST.
  abstract const nothrow @safe bool `dstInEffect`(long `stdTime`);
    Takes the number of hnsecs (100 ns) since midnight, January 1st, 1 A.D. in UTC time (i.e. std time) and returns whether DST is effect in this time zone at the given point in time.
    Parameters:

    long `stdTime` | The UTC time that needs to be checked for DST in this time zone.

  abstract const nothrow @safe long `utcToTZ`(long `stdTime`);
    Takes the number of hnsecs (100 ns) since midnight, January 1st, 1 A.D. in UTC time (i.e. std time) and converts it to this time zone's time.
    Parameters:

    long `stdTime` | The UTC time that needs to be adjusted to this time zone's time.

  abstract const nothrow @safe long `tzToUTC`(long `adjTime`);
    Takes the number of hnsecs (100 ns) since midnight, January 1st, 1 A.D. in this time zone's time and converts it to UTC (i.e. std time).
    Parameters:

    long `adjTime` | The time in this time zone that needs to be adjusted to UTC time.

  const nothrow @safe Duration `utcOffsetAt`(long `stdTime`);
    Returns what the offset from UTC is at the given std time. It includes the DST offset in effect at that time (if any).
    Parameters:

    long `stdTime` | The UTC time for which to get the offset from UTC for this time zone.

  deprecated static @safe immutable(TimeZone) `getTimeZone`(string `name`);
    Deprecated. Use either PosixTimeZone.`getTimeZone` or WindowsTimeZone.`getTimeZone`. (parseTZConversions can be used to convert time zone names if necessary). Microsoft changes their time zones too often for us to compile the conversions into Phobos and have them be properly up-to-date. TimeZone.`getTimeZone` will be removed in July 2017.
    Returns a TimeZone with the give `name` per the TZ Database.
    This returns a PosixTimeZone on Posix systems and a WindowsTimeZone on Windows systems. For PosixTimeZone on Windows, call PosixTimeZone.`getTimeZone` directly and give it the location of the TZ Database time zone files on disk.
    On Windows, the given TZ Database `name` is converted to the corresponding time zone `name` on Windows prior to calling WindowsTimeZone.`getTimeZone`. This function allows for the same time zone names on both Windows and Posix systems.
    See Also:
    Wikipedia entry on TZ Database
    List of Time Zones
    Windows <-> TZ Database Name Conversion Table
    Parameters:

    string `name` | The TZ Database `name` of the desired time zone

    Throws:
    DateTimeException if the given time zone could not be found.
    Examples:

        auto tz = TimeZone.getTimeZone("America/Los_Angeles");

  deprecated static @safe string[] `getInstalledTZNames`(string `subName` = "");
    Deprecated. Use either PosixTimeZone.`getInstalledTZNames` or WindowsTimeZone.`getInstalledTZNames`. (parseTZConversions can be used to convert time zone names if necessary). Microsoft changes their time zones too often for us to compile the conversions into Phobos and have them be properly up-to-date. TimeZone.`getInstalledTZNames` will be removed in July 2017.
    Returns a list of the names of the time zones installed on the system.
    Providing a sub-name narrows down the list of time zones (which can number in the thousands). For example, passing in "America" as the sub-name returns only the time zones which begin with "America".
    On Windows, this function will convert the Windows time zone names to the corresponding TZ Database names with windowsTZNameToTZDatabaseName. To get the actual Windows time zone names, use WindowsTimeZone.`getInstalledTZNames` directly.
    Parameters:

    string `subName` | The first part of the time zones desired.

    Throws:
    FileException on Posix systems if it fails to read from disk. DateTimeException on Windows systems if it fails to read the registry.
class `LocalTime`: std.datetime.TimeZone;
  A TimeZone which represents the current local time zone on the system running your program.
  This uses the underlying C calls to adjust the time rather than using specific D code based off of system settings to calculate the time such as PosixTimeZone and WindowsTimeZone do. That also means that it will use whatever the current time zone is on the system, even if the system's time zone changes while the program is running.
  static pure nothrow @trusted immutable(LocalTime) `opCall`();
    LocalTime is a singleton class. LocalTime returns its only instance.
  const nothrow @property @safe string `name`();
    The `name` of the time zone per the TZ Database. This is the `name` used to get a TimeZone by `name` with TimeZone.getTimeZone.
    Note that this always returns the empty string. This is because time zones cannot be uniquely identified by the attributes given by the OS (such as the stdName and dstName), and neither Posix systems nor Windows systems provide an easy way to get the TZ Database `name` of the local time zone.
    See Also:
    Wikipedia entry on TZ Database
    List of Time Zones
  const nothrow @property @trusted string `stdName`();
    Typically, the abbreviation (generally 3 or 4 letters) for the time zone when DST is not in effect (e.g. PST). It is not necessarily unique.
    However, on Windows, it may be the unabbreviated name (e.g. Pacific Standard Time). Regardless, it is not the same as name.
    This property is overridden because the local time of the system could change while the program is running and we need to determine it dynamically rather than it being fixed like it would be with most time zones.
  const nothrow @property @trusted string `dstName`();
    Typically, the abbreviation (generally 3 or 4 letters) for the time zone when DST is in effect (e.g. PDT). It is not necessarily unique.
    However, on Windows, it may be the unabbreviated name (e.g. Pacific Daylight Time). Regardless, it is not the same as name.
    This property is overridden because the local time of the system could change while the program is running and we need to determine it dynamically rather than it being fixed like it would be with most time zones.
  const nothrow @property @trusted bool `hasDST`();
    Whether this time zone has Daylight Savings Time at any point in time. Note that for some time zone types it may not have DST for current dates but will still return `true` for `hasDST` because the time zone did at some point have DST.
  const nothrow @trusted bool `dstInEffect`(long `stdTime`);
    Takes the number of hnsecs (100 ns) since midnight, January 1st, 1 A.D. in UTC time (i.e. std time) and returns whether DST is in effect in this time zone at the given point in time.
    Parameters:

    long `stdTime` | The UTC time that needs to be checked for DST in this time zone.

  const nothrow @trusted long `utcToTZ`(long `stdTime`);
    Returns hnsecs in the local time zone using the standard C function calls on Posix systems and the standard Windows system calls on Windows systems to adjust the time to the appropriate time zone from std time.
    Parameters:

    long `stdTime` | The UTC time that needs to be adjusted to this time zone's time.

    See Also:
    TimeZone.`utcToTZ`
  const nothrow @trusted long `tzToUTC`(long `adjTime`);
    Returns std time using the standard C function calls on Posix systems and the standard Windows system calls on Windows systems to adjust the time to UTC from the appropriate time zone.
    See Also:
    TimeZone.`tzToUTC`
    Parameters:

    long `adjTime` | The time in this time zone that needs to be adjusted to UTC time.

class `UTC`: std.datetime.TimeZone;
  A TimeZone which represents `UTC`.
  static pure nothrow @safe immutable(UTC) `opCall`();
    UTC is a singleton class. UTC returns its only instance.
  const nothrow @property @safe bool `hasDST`();
    Always returns `false`.
  const nothrow @safe bool `dstInEffect`(long `stdTime`);
    Always returns `false`.
  const nothrow @safe long `utcToTZ`(long `stdTime`);
    Returns the given hnsecs without changing them at all.
    Parameters:

    long `stdTime` | The UTC time that needs to be adjusted to this time zone's time.

    See Also:
    TimeZone.`utcToTZ`
  const nothrow @safe long `tzToUTC`(long `adjTime`);
    Returns the given hnsecs without changing them at all.
    See Also:
    TimeZone.`tzToUTC`
    Parameters:

    long `adjTime` | The time in this time zone that needs to be adjusted to UTC time.

  const nothrow @safe Duration `utcOffsetAt`(long `stdTime`);
    Returns a core.time.Duration of 0.
    Parameters:

    long `stdTime` | The UTC time for which to get the offset from UTC for this time zone.

class `SimpleTimeZone`: std.datetime.TimeZone;
  Represents a time zone with an offset (in minutes, west is negative) from UTC but no DST.
  It's primarily used as the time zone in the result of SysTime's fromISOString, fromISOExtString, and fromSimpleString.
  name and dstName are always the empty string since this time zone has no DST, and while it may be meant to represent a time zone which is in the TZ Database, obviously it's not likely to be following the exact rules of any of the time zones in the TZ Database, so it makes no sense to set it.
  const nothrow @property @safe bool `hasDST`();
    Always returns `false`.
  const nothrow @safe bool `dstInEffect`(long `stdTime`);
    Always returns `false`.
  const nothrow @safe long `utcToTZ`(long `stdTime`);
    Takes the number of hnsecs (100 ns) since midnight, January 1st, 1 A.D. in UTC time (i.e. std time) and converts it to this time zone's time.
    Parameters:

    long `stdTime` | The UTC time that needs to be adjusted to this time zone's time.

  const nothrow @safe long `tzToUTC`(long `adjTime`);
    Takes the number of hnsecs (100 ns) since midnight, January 1st, 1 A.D. in this time zone's time and converts it to UTC (i.e. std time).
    Parameters:

    long `adjTime` | The time in this time zone that needs to be adjusted to UTC time.

  const nothrow @safe Duration `utcOffsetAt`(long `stdTime`);
    Returns utcOffset as a core.time.Duration.
    Parameters:

    long `stdTime` | The UTC time for which to get the offset from UTC for this time zone.

  immutable pure @safe this(Duration `utcOffset`, string `stdName` = "");
    Parameters:

    Duration `utcOffset` | This time zone's offset from UTC with west of UTC being negative (it is added to UTC to get the adjusted time).
    string `stdName` | The `stdName` for this time zone.

  const pure nothrow @property @safe Duration `utcOffset`();
    The amount of time the offset from UTC is (negative is west of UTC, positive is east).
class `PosixTimeZone`: std.datetime.TimeZone;
  Represents a time zone from a TZ Database time zone file. Files from the TZ Database are how Posix systems hold their time zone information. Unfortunately, Windows does not use the TZ Database. To use the TZ Database, use `PosixTimeZone` (which reads its information from the TZ Database files on disk) on Windows by providing the TZ Database files and telling `PosixTimeZone`.getTimeZone where the directory holding them is.
  To get a `PosixTimeZone`, either call `PosixTimeZone`.getTimeZone (which allows specifying the location the time zone files) or call TimeZone.getTimeZone (which will give a `PosixTimeZone` on Posix systems and a WindowsTimeZone on Windows systems).

  Note: Unless your system's local time zone deals with leap seconds (which is highly unlikely), then the only way to get a time zone which takes leap seconds into account is to use `PosixTimeZone` with a time zone whose name starts with "right/". Those time zone files do include leap seconds, and `PosixTimeZone` will take them into account (though posix systems which use a "right/" time zone as their local time zone will not take leap seconds into account even though they're in the file).

  See Also:
  Home of the TZ Database files
  Wikipedia entry on TZ Database
  List of Time Zones
  const nothrow @property @safe bool `hasDST`();
    Whether this time zone has Daylight Savings Time at any point in time. Note that for some time zone types it may not have DST for current dates but will still return `true` for `hasDST` because the time zone did at some point have DST.
  const nothrow @safe bool `dstInEffect`(long `stdTime`);
    Takes the number of hnsecs (100 ns) since midnight, January 1st, 1 A.D. in UTC time (i.e. std time) and returns whether DST is in effect in this time zone at the given point in time.
    Parameters:

    long `stdTime` | The UTC time that needs to be checked for DST in this time zone.

  const nothrow @safe long `utcToTZ`(long `stdTime`);
    Takes the number of hnsecs (100 ns) since midnight, January 1st, 1 A.D. in UTC time (i.e. std time) and converts it to this time zone's time.
    Parameters:

    long `stdTime` | The UTC time that needs to be adjusted to this time zone's time.

  const nothrow @safe long `tzToUTC`(long `adjTime`);
    Takes the number of hnsecs (100 ns) since midnight, January 1st, 1 A.D. in this time zone's time and converts it to UTC (i.e. std time).
    Parameters:

    long `adjTime` | The time in this time zone that needs to be adjusted to UTC time.

  enum string `defaultTZDatabaseDir`;
    The default directory where the TZ Database files are. It's empty for Windows, since Windows doesn't have them.
  static @trusted immutable(PosixTimeZone) `getTimeZone`(string `name`, string `tzDatabaseDir` = defaultTZDatabaseDir);
    Returns a TimeZone with the give `name` per the TZ Database. The time zone information is fetched from the TZ Database time zone files in the given directory.
    See Also:
    Wikipedia entry on TZ Database
    List of Time Zones
    Parameters:

    string `name` | The TZ Database `name` of the desired time zone
    string `tzDatabaseDir` | The directory where the TZ Database files are located. Because these files are not located on Windows systems, provide them and give their location here to use PosixTimeZones.

    Throws:
    DateTimeException if the given time zone could not be found or FileException if the TZ Database file could not be opened.
    Examples:

        version(Posix)
        {
            auto tz = PosixTimeZone.getTimeZone("America/Los_Angeles");

            assert(tz.name == "America/Los_Angeles");
            assert(tz.stdName == "PST");
            assert(tz.dstName == "PDT");
        }

  static @trusted string[] `getInstalledTZNames`(string `subName` = "", string `tzDatabaseDir` = defaultTZDatabaseDir);
    Returns a list of the names of the time zones installed on the system.
    Providing a sub-name narrows down the list of time zones (which can number in the thousands). For example, passing in "America" as the sub-name returns only the time zones which begin with "America".
    Parameters:

    string `subName` | The first part of the desired time zones.
    string `tzDatabaseDir` | The directory where the TZ Database files are located.

    Throws:
    FileException if it fails to read from disk.
class `WindowsTimeZone`: std.datetime.TimeZone;
  This class is Windows-Only.
  Represents a time zone from the Windows registry. Unfortunately, Windows does not use the TZ Database. To use the TZ Database, use PosixTimeZone (which reads its information from the TZ Database files on disk) on Windows by providing the TZ Database files and telling PosixTimeZone.getTimeZone where the directory holding them is.
  The TZ Database files and Windows' time zone information frequently do not match. Windows has many errors with regards to when DST switches occur (especially for historical dates). Also, the TZ Database files include far more time zones than Windows does. So, for accurate time zone information, use the TZ Database files with PosixTimeZone rather than `WindowsTimeZone`. However, because `WindowsTimeZone` uses Windows system calls to deal with the time, it's far more likely to match the behavior of other Windows programs. Be aware of the differences when selecting a method.
  `WindowsTimeZone` does not exist on Posix systems.
  To get a `WindowsTimeZone`, either call `WindowsTimeZone`.getTimeZone or call TimeZone.getTimeZone (which will give a PosixTimeZone on Posix systems and a `WindowsTimeZone` on Windows systems).
  See Also:
  Home of the TZ Database files
  const nothrow @property @safe bool `hasDST`();
    Whether this time zone has Daylight Savings Time at any point in time. Note that for some time zone types it may not have DST for current dates but will still return `true` for `hasDST` because the time zone did at some point have DST.
  const nothrow @safe bool `dstInEffect`(long `stdTime`);
    Takes the number of hnsecs (100 ns) since midnight, January 1st, 1 A.D. in UTC time (i.e. std time) and returns whether DST is in effect in this time zone at the given point in time.
    Parameters:

    long `stdTime` | The UTC time that needs to be checked for DST in this time zone.

  const nothrow @safe long `utcToTZ`(long `stdTime`);
    Takes the number of hnsecs (100 ns) since midnight, January 1st, 1 A.D. in UTC time (i.e. std time) and converts it to this time zone's time.
    Parameters:

    long `stdTime` | The UTC time that needs to be adjusted to this time zone's time.

  const nothrow @safe long `tzToUTC`(long `adjTime`);
    Takes the number of hnsecs (100 ns) since midnight, January 1st, 1 A.D. in this time zone's time and converts it to UTC (i.e. std time).
    Parameters:

    long `adjTime` | The time in this time zone that needs to be adjusted to UTC time.

  static @safe immutable(WindowsTimeZone) `getTimeZone`(string `name`);
    Returns a TimeZone with the given `name` per the Windows time zone names. The time zone information is fetched from the Windows registry.
    See Also:
    Wikipedia entry on TZ Database
    List of Time Zones
    Parameters:

    string `name` | The TZ Database `name` of the desired time zone.

    Throws:
    DateTimeException if the given time zone could not be found.

    Example:

        auto tz = WindowsTimeZone.getTimeZone("Pacific Standard Time");

  static @safe string[] `getInstalledTZNames`();
    Returns a list of the names of the time zones installed on the system. The list returned by WindowsTimeZone contains the Windows TZ names, not the TZ Database names. However, TimeZone.getinstalledTZNames will return the TZ Database names which are equivalent to the Windows TZ names.
nothrow @safe void `setTZEnvVar`(string `tzDatabaseName`);
  This function is Posix-Only.
  Sets the local time zone on Posix systems with the TZ Database name by setting the TZ environment variable.
  Unfortunately, there is no way to do it on Windows using the TZ Database name, so this function only exists on Posix systems.
nothrow @safe void `clearTZEnvVar`();
  This function is Posix-Only.
  Clears the TZ environment variable.
struct `TZConversions`;
pure @safe TZConversions `parseTZConversions`(string `windowsZonesXMLText`);
  Provides the conversions between the IANA time zone database time zone names (which POSIX systems use) and the time zone names that Windows uses.
  Windows uses a different set of time zone names than the IANA time zone database does, and how they correspond to one another changes over time (particularly when Microsoft updates Windows). windowsZones.xml provides the current conversions (which may or may not match up with what's on a particular Windows box depending on how up-to-date it is), and `parseTZConversions` reads in those conversions from windowsZones.xml so that a D program can use those conversions.
  However, it should be noted that the time zone information on Windows is frequently less accurate than that in the IANA time zone database, and if someone really wants accurate time zone information, they should use the IANA time zone database files with PosixTimeZone on Windows rather than WindowsTimeZone, whereas WindowsTimeZone makes more sense when trying to match what Windows will think the time is in a specific time zone.
  Also, the IANA time zone database has a lot more time zones than Windows does.
  Parameters:

  Throws:
  Exception if there is an error while parsing the given XML.

          // Parse the conversions from a local file.
          auto text = std.file.readText("path/to/windowsZones.xml");
          auto conversions = parseTZConversions(text);

          // Alternatively, grab the XML file from the web at runtime
          // and parse it so that it's guaranteed to be up-to-date, though
          // that has the downside that the code needs to worry about the
          // site being down or unicode.org changing the URL.
          auto url = "http://unicode.org/cldr/data/common/supplemental/windowsZones.xml";
          auto conversions2 = parseTZConversions(std.net.curl.get(url));

  string[][string] `toWindows`;
    The key is the Windows time zone name, and the value is a list of IANA TZ database names which are close (currently only ever one, but it allows for multiple in case it's ever necessary).
  string[][string] `fromWindows`;
    The key is the IANA time zone database name, and the value is a list of Windows time zone names which are close (usually only one, but it could be multiple).
deprecated pure nothrow @nogc @safe string `tzDatabaseNameToWindowsTZName`(string `tzName`);
  Deprecated. Use parseTZConversions instead. Microsoft changes their time zones too often for us to compile the conversions into Phobos and have them be properly up-to-date. `tzDatabaseNameToWindowsTZName` will be removed in July 2017.
  Converts the given TZ Database name to the corresponding Windows time zone name.
  Note that in a few cases, a TZ Dabatase name corresponds to two different Windows time zone names. So, while in most cases converting from one to the other and back again will result in the same time zone name started with, in a few case, it'll get a different name.
  Also, there are far more TZ Database names than Windows time zones, so some of the more exotic TZ Database names don't have corresponding Windows time zone names.
  Returns `null` if the given time zone name cannot be converted.
  See Also:
  Windows <-> TZ Database Name Conversion Table
  Parameters:

  string `tzName` | The TZ Database name to convert.

deprecated pure nothrow @nogc @safe string `windowsTZNameToTZDatabaseName`(string `tzName`);
  Deprecated. Use parseTZConversions instead. Microsoft changes their time zones too often for us to compile the conversions into Phobos and have them be properly up-to-date. `windowsTZNameToTZDatabaseName` will be removed in July 2017.
  Converts the given Windows time zone name to a corresponding TZ Database name.
  Returns `null` if the given time zone name cannot be converted.
  See Also:
  Windows <-> TZ Database Name Conversion Table
  Parameters:

  string `tzName` | The TZ Database name to convert.

struct `StopWatch`;
  `StopWatch` measures time as precisely as possible.
  This class uses a high-performance counter. On Windows systems, it uses QueryPerformanceCounter, and on Posix systems, it uses clock_gettime if available, and gettimeofday otherwise.
  But the precision of `StopWatch` differs from system to system. It is impossible to for it to be the same from system to system since the precision of the system clock varies from system to system, and other system-dependent and situation-dependent stuff (such as the overhead of a context switch between threads) can also affect `StopWatch`'s accuracy.
  Examples:

      void writeln(S...)(S args){}
      static void bar() {}

      StopWatch sw;
      enum n = 100;
      TickDuration[n] times;
      TickDuration last = TickDuration.from!"seconds"(0);
      foreach (i; 0..n)
      {
         sw.start(); //start/resume mesuring.
         foreach (unused; 0..1_000_000)
             bar();
         sw.stop();  //stop/pause measuring.
         //Return value of peek() after having stopped are the always same.
         writeln((i + 1) * 1_000_000, " times done, lap time: ",
                 sw.peek().msecs, "[ms]");
         times[i] = sw.peek() - last;
         last = sw.peek();
      }
      real sum = 0;
      // To get the number of seconds,
      // use properties of TickDuration.
      // (seconds, msecs, usecs, hnsecs)
      foreach (t; times)
         sum += t.hnsecs;
      writeln("Average time: ", sum/n, " hnsecs");

  @nogc @safe this(AutoStart `autostart`);
    Auto start with constructor.
  const pure nothrow @nogc @safe bool `opEquals`(const StopWatch `rhs`);
  const pure nothrow @nogc @safe bool `opEquals`(ref const StopWatch `rhs`);
  @nogc @safe void `reset`();
    Resets the stop watch.
    Examples:

        StopWatch sw;
        sw.start();
        sw.stop();
        sw.reset();
        assert(sw.peek().to!("seconds", real)() == 0);

  @nogc @safe void `start`();
    Starts the stop watch.
  @nogc @safe void `stop`();
    Stops the `stop` watch.
  const @nogc @safe TickDuration `peek`();
    Peek at the amount of time which has passed since the stop watch was started.
  @nogc @safe void `setMeasured`(TickDuration `d`);
    Set the amount of time which has been measured since the stop watch was started.
  const pure nothrow @nogc @property @safe bool `running`();
    Confirm whether this stopwatch is measuring time.
TickDuration[fun.length] `benchmark`(fun...)(uint `n`);
  Benchmarks code for speed assessment and comparison.
  Parameters:

  fun | aliases of callable objects (e.g. function names). Each should take no arguments.
  uint `n` | The number of times each function is to be executed.

  Returns:
  The amount of time (as a core.time.TickDuration) that it took to call each function `n` times. The first value is the length of time that it took to call fun[0] `n` times. The second value is the length of time it took to call fun[1] `n` times. Etc.
  Note that casting the TickDurations to core.time.Durations will make the results easier to deal with (and it may change in the future that `benchmark` will return an array of Durations rather than TickDurations).
  See Also:
  measureTime
  Examples:

      import std.conv : to;
      int a;
      void f0() {}
      void f1() {auto b = a;}
      void f2() {auto b = to!string(a);}
      auto r = benchmark!(f0, f1, f2)(10_000);
      auto f0Result = to!Duration(r[0]); // time f0 took to run 10,000 times
      auto f1Result = to!Duration(r[1]); // time f1 took to run 10,000 times
      auto f2Result = to!Duration(r[2]); // time f2 took to run 10,000 times

struct `ComparingBenchmarkResult`;
  Return value of benchmark with two functions comparing.
  const pure nothrow @property @safe real `point`();
    Evaluation value
    This returns the evaluation value of performance as the ratio of baseFunc's time over targetFunc's time. If performance is high, this returns a high value.
  const pure nothrow @property @safe TickDuration `baseTime`();
    The time required of the base function
  const pure nothrow @property @safe TickDuration `targetTime`();
    The time required of the target function
ComparingBenchmarkResult `comparingBenchmark`(alias baseFunc, alias targetFunc, int times = 4095)();
  Benchmark with two functions comparing.
  Parameters:

  baseFunc | The function to become the base of the speed.
  targetFunc | The function that wants to measure speed.
  times | The number of times each function is to be executed.

  Examples:

      void f1x() {}
      void f2x() {}
      @safe void f1o() {}
      @safe void f2o() {}
      auto b1 = comparingBenchmark!(f1o, f2o, 1)(); // OK
      //writeln(b1.point);

enum auto `isTimePoint`(T);
  Whether the given type defines all of the necessary functions for it to function as a time point.
  1. T must define a static property named min which is the smallest value of T as .
  2. T must define a static property named max which is the largest value of T as .
  3. T must define an opBinary for addition and subtraction that accepts core.time.Duration and returns Unqual!T.
  4. T must define an opOpAssign for addition and subtraction that accepts core.time.Duration and returns ref Unqual!T.
  5. T must define a opBinary for subtraction which accepts T and returns returns core.time.Duration.
  Examples:

      static assert(isTimePoint!Date);
      static assert(isTimePoint!DateTime);
      static assert(isTimePoint!SysTime);
      static assert(isTimePoint!TimeOfDay);

      static assert(!isTimePoint!int);
      static assert(!isTimePoint!Duration);
      static assert(!isTimePoint!(Interval!SysTime));

static pure nothrow @safe bool `yearIsLeapYear`(int `year`);
  Whether the given Gregorian Year is a leap `year`.
  Parameters:

  int `year` | The `year` to to be tested.

pure nothrow @safe long `unixTimeToStdTime`(long `unixTime`);
  Converts from unix time (which uses midnight, January 1st, 1970 UTC as its epoch and seconds as its units) to "std time" (which uses midnight, January 1st, 1 A.D. UTC and hnsecs as its units).
  The C standard does not specify the representation of time_t, so it is implementation defined. On POSIX systems, unix time is equivalent to time_t, but that's not necessarily `true` on other systems (e.g. it is not `true` for the Digital Mars C runtime). So, be careful when using unix time with C functions on non-POSIX systems.
  "std time"'s epoch is based on the Proleptic Gregorian Calendar per ISO 8601 and is what SysTime uses internally. However, holding the time as an integer in hnescs since that epoch technically isn't actually part of the standard, much as it's based on it, so the name "std time" isn't particularly good, but there isn't an official name for it. C# uses "ticks" for the same thing, but they aren't actually clock ticks, and the term "ticks" is used for actual clock ticks for core.time.MonoTime, so it didn't make sense to use the term ticks here. So, for better or worse, std.datetime uses the term "std time" for this.
  Parameters:

  long `unixTime` | The unix time to convert.

  See Also:
  SysTime.fromUnixTime
  Examples:

      // Midnight, January 1st, 1970
      assert(unixTimeToStdTime(0) == 621_355_968_000_000_000L);
      assert(SysTime(unixTimeToStdTime(0)) ==
             SysTime(DateTime(1970, 1, 1), UTC()));

      assert(unixTimeToStdTime(int.max) == 642_830_804_470_000_000L);
      assert(SysTime(unixTimeToStdTime(int.max)) ==
             SysTime(DateTime(2038, 1, 19, 3, 14, 07), UTC()));

      assert(unixTimeToStdTime(-127_127) == 621_354_696_730_000_000L);
      assert(SysTime(unixTimeToStdTime(-127_127)) ==
             SysTime(DateTime(1969, 12, 30, 12, 41, 13), UTC()));

pure nothrow @safe T `stdTimeToUnixTime`(T = time_t)(long `stdTime`)
if (is(T == int) || is(T == long));
  Converts std time (which uses midnight, January 1st, 1 A.D. UTC as its epoch and hnsecs as its units) to unix time (which uses midnight, January 1st, 1970 UTC as its epoch and seconds as its units).
  The C standard does not specify the representation of time_t, so it is implementation defined. On POSIX systems, unix time is equivalent to time_t, but that's not necessarily `true` on other systems (e.g. it is not `true` for the Digital Mars C runtime). So, be careful when using unix time with C functions on non-POSIX systems.
  "std time"'s epoch is based on the Proleptic Gregorian Calendar per ISO 8601 and is what SysTime uses internally. However, holding the time as an integer in hnescs since that epoch technically isn't actually part of the standard, much as it's based on it, so the name "std time" isn't particularly good, but there isn't an official name for it. C# uses "ticks" for the same thing, but they aren't actually clock ticks, and the term "ticks" is used for actual clock ticks for core.time.MonoTime, so it didn't make sense to use the term ticks here. So, for better or worse, std.datetime uses the term "std time" for this.
  By default, the return type is time_t (which is normally an alias for int on 32-bit systems and long on 64-bit systems), but if a different size is required than either int or long can be passed as a template argument to get the desired size.
  If the return type is int, and the result can't fit in an int, then the closest value that can be held in 32 bits will be used (so int.max if it goes over and int.min if it goes under). However, no attempt is made to deal with integer overflow if the return type is long.
  Parameters:

  T | The return type (int or long). It defaults to time_t, which is normally 32 bits on a 32-bit system and 64 bits on a 64-bit system.
  long `stdTime` | The std time to convert.

  Returns:
  A signed integer representing the unix time which is equivalent to the given std time.
  See Also:
  SysTime.toUnixTime
  Examples:

      // Midnight, January 1st, 1970 UTC
      assert(stdTimeToUnixTime(621_355_968_000_000_000L) == 0);

      // 2038-01-19 03:14:07 UTC
      assert(stdTimeToUnixTime(642_830_804_470_000_000L) == int.max);

@safe SysTime `SYSTEMTIMEToSysTime`(const SYSTEMTIME* `st`, immutable TimeZone `tz` = LocalTime());
  This function is Windows-Only.
  Converts a SYSTEMTIME struct to a SysTime.
  Parameters:

  SYSTEMTIME* `st` | The SYSTEMTIME struct to convert.
  TimeZone `tz` | The time zone that the time in the SYSTEMTIME struct is assumed to be (if the SYSTEMTIME was supplied by a Windows system call, the SYSTEMTIME will either be in local time or UTC, depending on the call).

  Throws:
  DateTimeException if the given SYSTEMTIME will not fit in a SysTime, which is highly unlikely to happen given that SysTime.max is in 29,228 A.D. and the maximum SYSTEMTIME is in 30,827 A.D.
@safe SYSTEMTIME `SysTimeToSYSTEMTIME`(in SysTime `sysTime`);
  This function is Windows-Only.
  Converts a SysTime to a SYSTEMTIME struct.
  The SYSTEMTIME which is returned will be set using the given SysTime's time zone, so to get the SYSTEMTIME in UTC, set the SysTime's time zone to UTC.
  Parameters:

  SysTime `sysTime` | The SysTime to convert.

  Throws:
  DateTimeException if the given SysTime will not fit in a SYSTEMTIME. This will only happen if the SysTime's date is prior to 1601 A.D.
@safe long `FILETIMEToStdTime`(const FILETIME* `ft`);
  This function is Windows-Only.
  Converts a FILETIME struct to the number of hnsecs since midnight, January 1st, 1 A.D.
  Parameters:

  FILETIME* `ft` | The FILETIME struct to convert.

  Throws:
  DateTimeException if the given FILETIME cannot be represented as the return value.
@safe SysTime `FILETIMEToSysTime`(const FILETIME* `ft`, immutable TimeZone `tz` = LocalTime());
  This function is Windows-Only.
  Converts a FILETIME struct to a SysTime.
  Parameters:

  FILETIME* `ft` | The FILETIME struct to convert.
  TimeZone `tz` | The time zone that the SysTime will be in (FILETIMEs are in UTC).

  Throws:
  DateTimeException if the given FILETIME will not fit in a SysTime.
@safe FILETIME `stdTimeToFILETIME`(long `stdTime`);
  This function is Windows-Only.
  Converts a number of hnsecs since midnight, January 1st, 1 A.D. to a FILETIME struct.
  Parameters:

  long `stdTime` | The number of hnsecs since midnight, January 1st, 1 A.D. UTC.

  Throws:
  DateTimeException if the given value will not fit in a FILETIME.
@safe FILETIME `SysTimeToFILETIME`(SysTime `sysTime`);
  This function is Windows-Only.
  Converts a SysTime to a FILETIME struct.
  FILETIMEs are always in UTC.
  Parameters:

  SysTime `sysTime` | The SysTime to convert.

  Throws:
  DateTimeException if the given SysTime will not fit in a FILETIME.
alias `DosFileTime` = uint;
  Type representing the DOS file date/time format.
@safe SysTime `DosFileTimeToSysTime`(DosFileTime `dft`, immutable TimeZone `tz` = LocalTime());
  Converts from DOS file date/time to SysTime.
  Parameters:

  DosFileTime `dft` | The DOS file time to convert.
  TimeZone `tz` | The time zone which the DOS file time is assumed to be in.

  Throws:
  DateTimeException if the DosFileTime is invalid.
@safe DosFileTime `SysTimeToDosFileTime`(SysTime `sysTime`);
  Converts from SysTime to DOS file date/time.
  Parameters:

  SysTime `sysTime` | The SysTime to convert.

  Throws:
  DateTimeException if the given SysTime cannot be converted to a DosFileTime.
@safe SysTime `parseRFC822DateTime`()(in char[] `value`);
@safe SysTime `parseRFC822DateTime`(R)(R `value`)
if (isRandomAccessRange!R && hasSlicing!R && hasLength!R && (is(Unqual!(ElementType!R) == char) || is(Unqual!(ElementType!R) == ubyte)));
  The given array of char or random-access range of char or ubyte is expected to be in the format specified in RFC 5322 section 3.3 with the grammar rule date-time. It is the date-time format commonly used in internet messages such as e-mail and HTTP. The corresponding SysTime will be returned.
  RFC 822 was the original spec (hence the function's name), whereas RFC 5322 is the current spec.
  The day of the week is ignored beyond verifying that it's a valid day of the week, as the day of the week can be inferred from the date. It is not checked whether the given day of the week matches the actual day of the week of the given date (though it is technically invalid per the spec if the day of the week doesn't match the actual day of the week of the given date).
  If the time zone is "-0000" (or considered to be equivalent to "-0000" by section 4.3 of the spec), a SimpleTimeZone with a utc offset of 0 is used rather than UTC, whereas "+0000" uses UTC.
  Note that because SysTime does not currently support having a second `value` of 60 (as is sometimes done for leap seconds), if the date-time `value` does have a `value` of 60 for the seconds, it is treated as 59.
  The one area in which this function violates RFC 5322 is that it accepts "\n" in folding whitespace in the place of "\r\n", because the HTTP spec requires it.
  Throws:
  DateTimeException if the given string doesn't follow the grammar for a date-time field or if the resulting SysTime is invalid.
  Examples:

      import std.exception : assertThrown;

      auto tz = new immutable SimpleTimeZone(hours(-8));
      assert(parseRFC822DateTime("Sat, 6 Jan 1990 12:14:19 -0800") ==
             SysTime(DateTime(1990, 1, 6, 12, 14, 19), tz));

      assert(parseRFC822DateTime("9 Jul 2002 13:11 +0000") ==
             SysTime(DateTime(2002, 7, 9, 13, 11, 0), UTC()));

      auto badStr = "29 Feb 2001 12:17:16 +0200";
      assertThrown!DateTimeException(parseRFC822DateTime(badStr));

pure nothrow @safe bool `validTimeUnits`(string[] `units`...);
  Whether all of the given strings are valid `units` of time.
  "nsecs" is not considered a valid unit of time. Nothing in std.datetime can handle precision greater than hnsecs, and the few functions in core.time which deal with "nsecs" deal with it explicitly.
pure @safe int `cmpTimeUnits`(string `lhs`, string `rhs`);
  Compares two time unit strings. "years" are the largest units and "hnsecs" are the smallest.
  Returns:

  this < `rhs` | < 0
  this == `rhs` | 0
  this > `rhs` | > 0

  Throws:
  DateTimeException if either of the given strings is not a valid time unit string.
template `CmpTimeUnits`(string lhs, string rhs) if (validTimeUnits(lhs, rhs))
  Compares two time unit strings at compile time. "years" are the largest units and "hnsecs" are the smallest.
  This template is used instead of cmpTimeUnits because exceptions can't be thrown at compile time and cmpTimeUnits must enforce that the strings it's given are valid time unit strings. This template uses a template constraint instead.
  Returns:

  this < rhs | < 0
  this == rhs | 0
  this > rhs | > 0

pure nothrow @safe bool `valid`(string units)(int `value`)
if (units == "months" || units == "hours" || units == "minutes" || units == "seconds");
  Returns whether the given `value` is `valid` for the given unit type when in a time point. Naturally, a duration is not held to a particular range, but the values in a time point are (e.g. a month must be in the range of 1 - 12 inclusive).
  Parameters:

  units | The units of time to validate.
  int `value` | The number to validate.

  Examples:

      assert(valid!"hours"(12));
      assert(!valid!"hours"(32));
      assert(valid!"months"(12));
      assert(!valid!"months"(13));

pure nothrow @safe bool `valid`(string units)(int `year`, int `month`, int `day`)
if (units == "days");
  Returns whether the given `day` is `valid` for the given `year` and `month`.
  Parameters:

  units | The units of time to validate.
  int `year` | The `year` of the `day` to validate.
  int `month` | The `month` of the `day` to validate.
  int `day` | The `day` to validate.

pure @safe void `enforceValid`(string units)(int `value`, string `file` = __FILE__, size_t `line` = __LINE__)
if (units == "months" || units == "hours" || units == "minutes" || units == "seconds");
  Parameters:

  units | The units of time to validate.
  int `value` | The number to validate.
  string `file` | The `file` that the DateTimeException will list if thrown.
  size_t `line` | The `line` number that the DateTimeException will list if thrown.

  Throws:
  DateTimeException if valid!units(`value`) is `false`.
pure @safe void `enforceValid`(string units)(int `year`, Month `month`, int `day`, string `file` = __FILE__, size_t `line` = __LINE__)
if (units == "days");
  Parameters:

  units | The units of time to validate.
  int `year` | The `year` of the `day` to validate.
  Month `month` | The `month` of the `day` to validate.
  int `day` | The `day` to validate.
  string `file` | The `file` that the DateTimeException will list if thrown.
  size_t `line` | The `line` number that the DateTimeException will list if thrown.

  Throws:
  DateTimeException if valid!"days"(`year`, `month`, `day`) is `false`.
static pure @safe int `monthsToMonth`(int `currMonth`, int `month`);
  Returns the number of months from the current months of the year to the given `month` of the year. If they are the same, then the result is 0.
  Parameters:

  int `currMonth` | The current `month` of the year.
  int `month` | The `month` of the year to get the number of months to.

static pure nothrow @safe int `daysToDayOfWeek`(DayOfWeek `currDoW`, DayOfWeek `dow`);
  Returns the number of days from the current day of the week to the given day of the week. If they are the same, then the result is 0.
  Parameters:

  DayOfWeek `currDoW` | The current day of the week.
  DayOfWeek `dow` | The day of the week to get the number of days to.

@safe auto `measureTime`(alias func)()
if (isSafe!(() { StopWatch sw; unaryFun!func(sw.peek()); } ));
  Function for starting to a stop watch time when the function is called and stopping it when its return value goes out of scope and is destroyed.
  When the value that is returned by this function is destroyed, func will run. func is a unary function that takes a core.time.TickDuration.

  Example:

      {
          auto mt = measureTime!((TickDuration a)
              { /+ do something when the scope is exited +/ });
          // do something that needs to be timed
      }

  which is functionally equivalent to

      {
          auto sw = StopWatch(Yes.autoStart);
          scope(exit)
          {
              TickDuration a = sw.peek();
              /+ do something when the scope is exited +/
          }
          // do something that needs to be timed
      }

  See Also:
  benchmark

Copyright © 1999-2017 by the D Language Foundation | Page generated by Ddoc on Thu Feb 16 13:40:03 2017