# LocalDateTime

<a id="localdatetime"></a>

# LocalDateTime

```cpp
#include <icy/datetime.h>

class LocalDateTime
```

[Defined in src/base/include/icy/datetime.h:703](https://github.com/auscaster/icey/blob/main/src/base/include/icy/datetime.h#L703)

This class represents an instant in local time (as opposed to UTC), expressed in years, months, days, hours, minutes, seconds and milliseconds based on the Gregorian calendar.

In addition to the date and time, the class also maintains a time zone differential, which denotes the difference in seconds from UTC to local time, i.e. UTC = local time - time zone differential.

Although [LocalDateTime](#localdatetime) supports relational and arithmetic operators, all date/time comparisons and date/time arithmetics should be done in UTC, using the [DateTime](https://auscaster.com/icey/docs/api-reference/icy-DateTime.md#datetime) or [Timestamp](https://auscaster.com/icey/docs/api-reference/icy-Timestamp.md#timestamp-2) class for better performance. The relational operators normalize the dates/times involved to UTC before carrying out the comparison.

The time zone differential is based on the input date and time and current time zone. A number of constructors accept an explicit time zone differential parameter. These should not be used since daylight savings time processing is impossible since the time zone is unknown. Each of the constructors accepting a tzd parameter have been marked as deprecated and may be removed in a future revision.

## Friends

| Name | Description |
|------|-------------|
| [`DateTimeFormatter`](#datetimeformatter-1)  |  |
| [`DateTimeParser`](#datetimeparser-1)  |  |

---

<a id="datetimeformatter-1"></a>

### DateTimeFormatter

```cpp
friend class DateTimeFormatter
```

[Defined in src/base/include/icy/datetime.h:919](https://github.com/auscaster/icey/blob/main/src/base/include/icy/datetime.h#L919)

---

<a id="datetimeparser-1"></a>

### DateTimeParser

```cpp
friend class DateTimeParser
```

[Defined in src/base/include/icy/datetime.h:920](https://github.com/auscaster/icey/blob/main/src/base/include/icy/datetime.h#L920)

## Public Methods

| Return | Name | Description |
|--------|------|-------------|
|  | [`LocalDateTime`](#localdatetime-1)  | Creates a [LocalDateTime](#localdatetime) with the current date/time for the current time zone. |
|  | [`LocalDateTime`](#localdatetime-2)  | Creates a [LocalDateTime](#localdatetime) for the given Gregorian local date and time. |
|  | [`LocalDateTime`](#localdatetime-3)  | @ deprecated Creates a [LocalDateTime](#localdatetime) for the given Gregorian date and time in the time zone denoted by the time zone differential in tzd. |
|  | [`LocalDateTime`](#localdatetime-4)  | Creates a [LocalDateTime](#localdatetime) from the UTC time given in dateTime, using the time zone differential of the current time zone. |
|  | [`LocalDateTime`](#localdatetime-5)  | @ deprecated Creates a [LocalDateTime](#localdatetime) from the UTC time given in dateTime, using the given time zone differential. Adjusts dateTime for the given time zone differential. |
|  | [`LocalDateTime`](#localdatetime-6)  | @ deprecated Creates a [LocalDateTime](#localdatetime) from the UTC time given in dateTime, using the given time zone differential. If adjust is true, adjusts dateTime for the given time zone differential. |
|  | [`LocalDateTime`](#localdatetime-7)  | Creates a [LocalDateTime](#localdatetime) for the given Julian day in the local time zone. |
|  | [`LocalDateTime`](#localdatetime-8)  | @ deprecated Creates a [LocalDateTime](#localdatetime) for the given Julian day in the time zone denoted by the time zone differential in tzd. |
|  | [`LocalDateTime`](#localdatetime-9)  | Copy constructor. Creates the [LocalDateTime](#localdatetime) from another one. |
|  | [`~LocalDateTime`](#localdatetime-10)  | Destroys the [LocalDateTime](#localdatetime). |
| [`LocalDateTime`](#localdatetime) & | [`operator=`](#operator-45)  | Assigns another [LocalDateTime](#localdatetime). |
| [`LocalDateTime`](#localdatetime) & | [`operator=`](#operator-46)  | Assigns a timestamp. |
| [`LocalDateTime`](#localdatetime) & | [`operator=`](#operator-47)  | Assigns a Julian day in the local time zone. |
| [`LocalDateTime`](#localdatetime) & | [`assign`](#assign-1)  | Assigns a Gregorian local date and time. |
| [`LocalDateTime`](#localdatetime) & | [`assign`](#assign-2)  | @ deprecated Assigns a Gregorian local date and time in the time zone denoted by the time zone differential in tzd. |
| [`LocalDateTime`](#localdatetime) & | [`assign`](#assign-3)  | @ deprecated Assigns a Julian day in the time zone denoted by the time zone differential in tzd. |
| `void` | [`swap`](#swap-6)  | Swaps the [LocalDateTime](#localdatetime) with another one. |
| `int` | [`year`](#year-1) `const` `inline` | Returns the year. |
| `int` | [`month`](#month-1) `const` `inline` | Returns the month (1 to 12). |
| `int` | [`week`](#week-1) `const` `inline` | Returns the week number within the year. FirstDayOfWeek should be either SUNDAY (0) or MONDAY (1). The returned week number will be from 0 to 53. Week number 1 is the week containing January 4. This is in accordance to ISO 8601. |
| `int` | [`day`](#day-1) `const` `inline` | Returns the day witin the month (1 to 31). |
| `int` | [`dayOfWeek`](#dayofweek-1) `const` `inline` | Returns the weekday (0 to 6, where 0 = Sunday, 1 = Monday, ..., 6 = Saturday). |
| `int` | [`dayOfYear`](#dayofyear-1) `const` `inline` | Returns the number of the day in the year. January 1 is 1, February 1 is 32, etc. |
| `int` | [`hour`](#hour-1) `const` `inline` | Returns the hour (0 to 23). |
| `int` | [`hourAMPM`](#hourampm-1) `const` `inline` | Returns the hour (0 to 12). |
| `bool` | [`isAM`](#isam-1) `const` `inline` | Returns true if hour < 12;. |
| `bool` | [`isPM`](#ispm-1) `const` `inline` | Returns true if hour >= 12. |
| `int` | [`minute`](#minute-1) `const` `inline` | Returns the minute (0 to 59). |
| `int` | [`second`](#second-1) `const` `inline` | Returns the second (0 to 59). |
| `int` | [`millisecond`](#millisecond-1) `const` `inline` | Returns the millisecond (0 to 999) |
| `int` | [`microsecond`](#microsecond-1) `const` `inline` | Returns the microsecond (0 to 999) |
| `double` | [`julianDay`](#julianday-1) `const` `inline` | Returns the julian day for the date. |
| `int` | [`tzd`](#tzd) `const` `inline` | Returns the time zone differential. |
| [`DateTime`](https://auscaster.com/icey/docs/api-reference/icy-DateTime.md#datetime) | [`utc`](#utc) `const` | Returns the UTC equivalent for the local date and time. |
| [`Timestamp`](https://auscaster.com/icey/docs/api-reference/icy-Timestamp.md#timestamp-2) | [`timestamp`](#timestamp-1) `const` `inline` | Returns the date and time expressed as a [Timestamp](https://auscaster.com/icey/docs/api-reference/icy-Timestamp.md#timestamp-2). |
| [`Timestamp::UtcTimeVal`](https://auscaster.com/icey/docs/api-reference/icy-Timestamp.md#utctimeval) | [`utcTime`](#utctime-1) `const` `inline` | Returns the UTC equivalent for the local date and time. |
| `bool` | [`operator==`](#operator-48) `const` |  |
| `bool` | [`operator!=`](#operator-49) `const` |  |
| `bool` | [`operator<`](#operator-50) `const` |  |
| `bool` | [`operator<=`](#operator-51) `const` |  |
| `bool` | [`operator>`](#operator-52) `const` |  |
| `bool` | [`operator>=`](#operator-53) `const` |  |
| [`LocalDateTime`](#localdatetime) | [`operator+`](#operator-54) `const` |  |
| [`LocalDateTime`](#localdatetime) | [`operator-`](#operator-55) `const` |  |
| [`Timespan`](https://auscaster.com/icey/docs/api-reference/icy-Timespan.md#timespan) | [`operator-`](#operator-56) `const` |  |
| [`LocalDateTime`](#localdatetime) & | [`operator+=`](#operator-57)  |  |
| [`LocalDateTime`](#localdatetime) & | [`operator-=`](#operator-58)  |  |

---

<a id="localdatetime-1"></a>

### LocalDateTime

```cpp
LocalDateTime()
```

[Defined in src/base/include/icy/datetime.h:708](https://github.com/auscaster/icey/blob/main/src/base/include/icy/datetime.h#L708)

Creates a [LocalDateTime](#localdatetime) with the current date/time for the current time zone.

---

<a id="localdatetime-2"></a>

### LocalDateTime

```cpp
LocalDateTime(int year, int month, int day, int hour = 0, int minute = 0, int second = 0, int millisecond = 0, int microsecond = 0)
```

[Defined in src/base/include/icy/datetime.h:719](https://github.com/auscaster/icey/blob/main/src/base/include/icy/datetime.h#L719)

Creates a [LocalDateTime](#localdatetime) for the given Gregorian local date and time.

* year is from 0 to 9999.
* month is from 1 to 12.
* day is from 1 to 31.
* hour is from 0 to 23.
* minute is from 0 to 59.
* second is from 0 to 59.
* millisecond is from 0 to 999.
* microsecond is from 0 to 999.

---

<a id="localdatetime-3"></a>

### LocalDateTime

```cpp
LocalDateTime(int tzd, int year, int month, int day, int hour, int minute, int second, int millisecond, int microsecond)
```

[Defined in src/base/include/icy/datetime.h:734](https://github.com/auscaster/icey/blob/main/src/base/include/icy/datetime.h#L734)

@ deprecated Creates a [LocalDateTime](#localdatetime) for the given Gregorian date and time in the time zone denoted by the time zone differential in tzd.

* tzd is in seconds.
* year is from 0 to 9999.
* month is from 1 to 12.
* day is from 1 to 31.
* hour is from 0 to 23.
* minute is from 0 to 59.
* second is from 0 to 59.
* millisecond is from 0 to 999.
* microsecond is from 0 to 999.

---

<a id="localdatetime-4"></a>

### LocalDateTime

```cpp
LocalDateTime(const DateTime & dateTime)
```

[Defined in src/base/include/icy/datetime.h:739](https://github.com/auscaster/icey/blob/main/src/base/include/icy/datetime.h#L739)

Creates a [LocalDateTime](#localdatetime) from the UTC time given in dateTime, using the time zone differential of the current time zone.

---

<a id="localdatetime-5"></a>

### LocalDateTime

```cpp
LocalDateTime(int tzd, const DateTime & dateTime)
```

[Defined in src/base/include/icy/datetime.h:745](https://github.com/auscaster/icey/blob/main/src/base/include/icy/datetime.h#L745)

@ deprecated Creates a [LocalDateTime](#localdatetime) from the UTC time given in dateTime, using the given time zone differential. Adjusts dateTime for the given time zone differential.

---

<a id="localdatetime-6"></a>

### LocalDateTime

```cpp
LocalDateTime(int tzd, const DateTime & dateTime, bool adjust)
```

[Defined in src/base/include/icy/datetime.h:752](https://github.com/auscaster/icey/blob/main/src/base/include/icy/datetime.h#L752)

@ deprecated Creates a [LocalDateTime](#localdatetime) from the UTC time given in dateTime, using the given time zone differential. If adjust is true, adjusts dateTime for the given time zone differential.

---

<a id="localdatetime-7"></a>

### LocalDateTime

```cpp
LocalDateTime(double julianDay)
```

[Defined in src/base/include/icy/datetime.h:755](https://github.com/auscaster/icey/blob/main/src/base/include/icy/datetime.h#L755)

Creates a [LocalDateTime](#localdatetime) for the given Julian day in the local time zone.

---

<a id="localdatetime-8"></a>

### LocalDateTime

```cpp
LocalDateTime(int tzd, double julianDay)
```

[Defined in src/base/include/icy/datetime.h:761](https://github.com/auscaster/icey/blob/main/src/base/include/icy/datetime.h#L761)

@ deprecated Creates a [LocalDateTime](#localdatetime) for the given Julian day in the time zone denoted by the time zone differential in tzd.

---

<a id="localdatetime-9"></a>

### LocalDateTime

```cpp
LocalDateTime(const LocalDateTime & dateTime)
```

[Defined in src/base/include/icy/datetime.h:764](https://github.com/auscaster/icey/blob/main/src/base/include/icy/datetime.h#L764)

Copy constructor. Creates the [LocalDateTime](#localdatetime) from another one.

---

<a id="localdatetime-10"></a>

### ~LocalDateTime

```cpp
~LocalDateTime()
```

[Defined in src/base/include/icy/datetime.h:767](https://github.com/auscaster/icey/blob/main/src/base/include/icy/datetime.h#L767)

Destroys the [LocalDateTime](#localdatetime).

---

<a id="operator-45"></a>

### operator=

```cpp
LocalDateTime & operator=(const LocalDateTime & dateTime)
```

[Defined in src/base/include/icy/datetime.h:770](https://github.com/auscaster/icey/blob/main/src/base/include/icy/datetime.h#L770)

Assigns another [LocalDateTime](#localdatetime).

---

<a id="operator-46"></a>

### operator=

```cpp
LocalDateTime & operator=(const Timestamp & timestamp)
```

[Defined in src/base/include/icy/datetime.h:773](https://github.com/auscaster/icey/blob/main/src/base/include/icy/datetime.h#L773)

Assigns a timestamp.

---

<a id="operator-47"></a>

### operator=

```cpp
LocalDateTime & operator=(double julianDay)
```

[Defined in src/base/include/icy/datetime.h:776](https://github.com/auscaster/icey/blob/main/src/base/include/icy/datetime.h#L776)

Assigns a Julian day in the local time zone.

---

<a id="assign-1"></a>

### assign

```cpp
LocalDateTime & assign(int year, int month, int day, int hour = 0, int minute = 0, int second = 0, int millisecond = 0, int microseconds = 0)
```

[Defined in src/base/include/icy/datetime.h:787](https://github.com/auscaster/icey/blob/main/src/base/include/icy/datetime.h#L787)

Assigns a Gregorian local date and time.

* year is from 0 to 9999.
* month is from 1 to 12.
* day is from 1 to 31.
* hour is from 0 to 23.
* minute is from 0 to 59.
* second is from 0 to 59.
* millisecond is from 0 to 999.
* microsecond is from 0 to 999.

---

<a id="assign-2"></a>

### assign

```cpp
LocalDateTime & assign(int tzd, int year, int month, int day, int hour, int minute, int second, int millisecond, int microseconds)
```

[Defined in src/base/include/icy/datetime.h:803](https://github.com/auscaster/icey/blob/main/src/base/include/icy/datetime.h#L803)

@ deprecated Assigns a Gregorian local date and time in the time zone denoted by the time zone differential in tzd.

* tzd is in seconds.
* year is from 0 to 9999.
* month is from 1 to 12.
* day is from 1 to 31.
* hour is from 0 to 23.
* minute is from 0 to 59.
* second is from 0 to 59.
* millisecond is from 0 to 999.
* microsecond is from 0 to 999.

---

<a id="assign-3"></a>

### assign

```cpp
LocalDateTime & assign(int tzd, double julianDay)
```

[Defined in src/base/include/icy/datetime.h:810](https://github.com/auscaster/icey/blob/main/src/base/include/icy/datetime.h#L810)

@ deprecated Assigns a Julian day in the time zone denoted by the time zone differential in tzd.

---

<a id="swap-6"></a>

### swap

```cpp
void swap(LocalDateTime & dateTime)
```

[Defined in src/base/include/icy/datetime.h:813](https://github.com/auscaster/icey/blob/main/src/base/include/icy/datetime.h#L813)

Swaps the [LocalDateTime](#localdatetime) with another one.

---

<a id="year-1"></a>

### year

`const` `inline`

```cpp
inline int year() const
```

[Defined in src/base/include/icy/datetime.h:816](https://github.com/auscaster/icey/blob/main/src/base/include/icy/datetime.h#L816)

Returns the year.

---

<a id="month-1"></a>

### month

`const` `inline`

```cpp
inline int month() const
```

[Defined in src/base/include/icy/datetime.h:819](https://github.com/auscaster/icey/blob/main/src/base/include/icy/datetime.h#L819)

Returns the month (1 to 12).

---

<a id="week-1"></a>

### week

`const` `inline`

```cpp
inline int week(int firstDayOfWeek = DateTime::MONDAY) const
```

[Defined in src/base/include/icy/datetime.h:835](https://github.com/auscaster/icey/blob/main/src/base/include/icy/datetime.h#L835)

Returns the week number within the year. FirstDayOfWeek should be either SUNDAY (0) or MONDAY (1). The returned week number will be from 0 to 53. Week number 1 is the week containing January 4. This is in accordance to ISO 8601.

The following example assumes that firstDayOfWeek is MONDAY. For 2005, which started on a Saturday, week 1 will be the week starting on Monday, January 3. January 1 and 2 will fall within week 0 (or the last week of the previous year).

For 2007, which starts on a Monday, week 1 will be the week startung on Monday, January 1. There will be no week 0 in 2007.

---

<a id="day-1"></a>

### day

`const` `inline`

```cpp
inline int day() const
```

[Defined in src/base/include/icy/datetime.h:838](https://github.com/auscaster/icey/blob/main/src/base/include/icy/datetime.h#L838)

Returns the day witin the month (1 to 31).

---

<a id="dayofweek-1"></a>

### dayOfWeek

`const` `inline`

```cpp
inline int dayOfWeek() const
```

[Defined in src/base/include/icy/datetime.h:842](https://github.com/auscaster/icey/blob/main/src/base/include/icy/datetime.h#L842)

Returns the weekday (0 to 6, where 0 = Sunday, 1 = Monday, ..., 6 = Saturday).

---

<a id="dayofyear-1"></a>

### dayOfYear

`const` `inline`

```cpp
inline int dayOfYear() const
```

[Defined in src/base/include/icy/datetime.h:846](https://github.com/auscaster/icey/blob/main/src/base/include/icy/datetime.h#L846)

Returns the number of the day in the year. January 1 is 1, February 1 is 32, etc.

---

<a id="hour-1"></a>

### hour

`const` `inline`

```cpp
inline int hour() const
```

[Defined in src/base/include/icy/datetime.h:849](https://github.com/auscaster/icey/blob/main/src/base/include/icy/datetime.h#L849)

Returns the hour (0 to 23).

---

<a id="hourampm-1"></a>

### hourAMPM

`const` `inline`

```cpp
inline int hourAMPM() const
```

[Defined in src/base/include/icy/datetime.h:852](https://github.com/auscaster/icey/blob/main/src/base/include/icy/datetime.h#L852)

Returns the hour (0 to 12).

---

<a id="isam-1"></a>

### isAM

`const` `inline`

```cpp
inline bool isAM() const
```

[Defined in src/base/include/icy/datetime.h:855](https://github.com/auscaster/icey/blob/main/src/base/include/icy/datetime.h#L855)

Returns true if hour < 12;.

---

<a id="ispm-1"></a>

### isPM

`const` `inline`

```cpp
inline bool isPM() const
```

[Defined in src/base/include/icy/datetime.h:858](https://github.com/auscaster/icey/blob/main/src/base/include/icy/datetime.h#L858)

Returns true if hour >= 12.

---

<a id="minute-1"></a>

### minute

`const` `inline`

```cpp
inline int minute() const
```

[Defined in src/base/include/icy/datetime.h:861](https://github.com/auscaster/icey/blob/main/src/base/include/icy/datetime.h#L861)

Returns the minute (0 to 59).

---

<a id="second-1"></a>

### second

`const` `inline`

```cpp
inline int second() const
```

[Defined in src/base/include/icy/datetime.h:864](https://github.com/auscaster/icey/blob/main/src/base/include/icy/datetime.h#L864)

Returns the second (0 to 59).

---

<a id="millisecond-1"></a>

### millisecond

`const` `inline`

```cpp
inline int millisecond() const
```

[Defined in src/base/include/icy/datetime.h:867](https://github.com/auscaster/icey/blob/main/src/base/include/icy/datetime.h#L867)

Returns the millisecond (0 to 999)

---

<a id="microsecond-1"></a>

### microsecond

`const` `inline`

```cpp
inline int microsecond() const
```

[Defined in src/base/include/icy/datetime.h:870](https://github.com/auscaster/icey/blob/main/src/base/include/icy/datetime.h#L870)

Returns the microsecond (0 to 999)

---

<a id="julianday-1"></a>

### julianDay

`const` `inline`

```cpp
inline double julianDay() const
```

[Defined in src/base/include/icy/datetime.h:873](https://github.com/auscaster/icey/blob/main/src/base/include/icy/datetime.h#L873)

Returns the julian day for the date.

---

<a id="tzd"></a>

### tzd

`const` `inline`

```cpp
inline int tzd() const
```

[Defined in src/base/include/icy/datetime.h:876](https://github.com/auscaster/icey/blob/main/src/base/include/icy/datetime.h#L876)

Returns the time zone differential.

---

<a id="utc"></a>

### utc

`const`

```cpp
DateTime utc() const
```

[Defined in src/base/include/icy/datetime.h:879](https://github.com/auscaster/icey/blob/main/src/base/include/icy/datetime.h#L879)

Returns the UTC equivalent for the local date and time.

---

<a id="timestamp-1"></a>

### timestamp

`const` `inline`

```cpp
inline Timestamp timestamp() const
```

[Defined in src/base/include/icy/datetime.h:882](https://github.com/auscaster/icey/blob/main/src/base/include/icy/datetime.h#L882)

Returns the date and time expressed as a [Timestamp](https://auscaster.com/icey/docs/api-reference/icy-Timestamp.md#timestamp-2).

---

<a id="utctime-1"></a>

### utcTime

`const` `inline`

```cpp
inline Timestamp::UtcTimeVal utcTime() const
```

[Defined in src/base/include/icy/datetime.h:885](https://github.com/auscaster/icey/blob/main/src/base/include/icy/datetime.h#L885)

Returns the UTC equivalent for the local date and time.

---

<a id="operator-48"></a>

### operator==

`const`

```cpp
bool operator==(const LocalDateTime & dateTime) const
```

[Defined in src/base/include/icy/datetime.h:887](https://github.com/auscaster/icey/blob/main/src/base/include/icy/datetime.h#L887)

---

<a id="operator-49"></a>

### operator!=

`const`

```cpp
bool operator!=(const LocalDateTime & dateTime) const
```

[Defined in src/base/include/icy/datetime.h:888](https://github.com/auscaster/icey/blob/main/src/base/include/icy/datetime.h#L888)

---

<a id="operator-50"></a>

### operator<

`const`

```cpp
bool operator<(const LocalDateTime & dateTime) const
```

[Defined in src/base/include/icy/datetime.h:889](https://github.com/auscaster/icey/blob/main/src/base/include/icy/datetime.h#L889)

---

<a id="operator-51"></a>

### operator<=

`const`

```cpp
bool operator<=(const LocalDateTime & dateTime) const
```

[Defined in src/base/include/icy/datetime.h:890](https://github.com/auscaster/icey/blob/main/src/base/include/icy/datetime.h#L890)

---

<a id="operator-52"></a>

### operator>

`const`

```cpp
bool operator>(const LocalDateTime & dateTime) const
```

[Defined in src/base/include/icy/datetime.h:891](https://github.com/auscaster/icey/blob/main/src/base/include/icy/datetime.h#L891)

---

<a id="operator-53"></a>

### operator>=

`const`

```cpp
bool operator>=(const LocalDateTime & dateTime) const
```

[Defined in src/base/include/icy/datetime.h:892](https://github.com/auscaster/icey/blob/main/src/base/include/icy/datetime.h#L892)

---

<a id="operator-54"></a>

### operator+

`const`

```cpp
LocalDateTime operator+(const Timespan & span) const
```

[Defined in src/base/include/icy/datetime.h:894](https://github.com/auscaster/icey/blob/main/src/base/include/icy/datetime.h#L894)

---

<a id="operator-55"></a>

### operator-

`const`

```cpp
LocalDateTime operator-(const Timespan & span) const
```

[Defined in src/base/include/icy/datetime.h:895](https://github.com/auscaster/icey/blob/main/src/base/include/icy/datetime.h#L895)

---

<a id="operator-56"></a>

### operator-

`const`

```cpp
Timespan operator-(const LocalDateTime & dateTime) const
```

[Defined in src/base/include/icy/datetime.h:896](https://github.com/auscaster/icey/blob/main/src/base/include/icy/datetime.h#L896)

---

<a id="operator-57"></a>

### operator+=

```cpp
LocalDateTime & operator+=(const Timespan & span)
```

[Defined in src/base/include/icy/datetime.h:897](https://github.com/auscaster/icey/blob/main/src/base/include/icy/datetime.h#L897)

---

<a id="operator-58"></a>

### operator-=

```cpp
LocalDateTime & operator-=(const Timespan & span)
```

[Defined in src/base/include/icy/datetime.h:898](https://github.com/auscaster/icey/blob/main/src/base/include/icy/datetime.h#L898)

## Protected Methods

| Return | Name | Description |
|--------|------|-------------|
|  | [`LocalDateTime`](#localdatetime-11)  |  |
| `void` | [`determineTzd`](#determinetzd)  | Recalculate the tzd based on the _dateTime member based on the current timezone using the Standard C runtime functions. If adjust is true, then [adjustForTzd()](#adjustfortzd) is called after the differential is calculated. |
| `void` | [`adjustForTzd`](#adjustfortzd) `inline` | Adjust the _dateTime member based on the _tzd member. |
| `std::time_t` | [`dstOffset`](#dstoffset) `const` | Determine the DST offset for the current date/time. |

---

<a id="localdatetime-11"></a>

### LocalDateTime

```cpp
LocalDateTime(Timestamp::UtcTimeVal utcTime, Timestamp::TimeDiff diff, int tzd)
```

[Defined in src/base/include/icy/datetime.h:901](https://github.com/auscaster/icey/blob/main/src/base/include/icy/datetime.h#L901)

---

<a id="determinetzd"></a>

### determineTzd

```cpp
void determineTzd(bool adjust = false)
```

[Defined in src/base/include/icy/datetime.h:907](https://github.com/auscaster/icey/blob/main/src/base/include/icy/datetime.h#L907)

Recalculate the tzd based on the _dateTime member based on the current timezone using the Standard C runtime functions. If adjust is true, then [adjustForTzd()](#adjustfortzd) is called after the differential is calculated.

---

<a id="adjustfortzd"></a>

### adjustForTzd

`inline`

```cpp
inline void adjustForTzd()
```

[Defined in src/base/include/icy/datetime.h:910](https://github.com/auscaster/icey/blob/main/src/base/include/icy/datetime.h#L910)

Adjust the _dateTime member based on the _tzd member.

---

<a id="dstoffset"></a>

### dstOffset

`const`

```cpp
std::time_t dstOffset(int & dstOffset) const
```

[Defined in src/base/include/icy/datetime.h:913](https://github.com/auscaster/icey/blob/main/src/base/include/icy/datetime.h#L913)

Determine the DST offset for the current date/time.

## Private Attributes

| Return | Name | Description |
|--------|------|-------------|
| [`DateTime`](https://auscaster.com/icey/docs/api-reference/icy-DateTime.md#datetime) | [`_dateTime`](#_datetime)  |  |
| `int` | [`_tzd`](#_tzd)  |  |

---

<a id="_datetime"></a>

### _dateTime

```cpp
DateTime _dateTime
```

Type: [`DateTime`](https://auscaster.com/icey/docs/api-reference/icy-DateTime.md#datetime)

[Defined in src/base/include/icy/datetime.h:916](https://github.com/auscaster/icey/blob/main/src/base/include/icy/datetime.h#L916)

---

<a id="_tzd"></a>

### _tzd

```cpp
int _tzd
```

[Defined in src/base/include/icy/datetime.h:917](https://github.com/auscaster/icey/blob/main/src/base/include/icy/datetime.h#L917)
