- Qt 6.6
- Qt Core
- C++ Classes
- QDate
- Qt 6.6.1 Reference Documentation

# Obsolete Members for QDate

The following members of class QDate are deprecated. They are provided to keep old source code working. We strongly advise against using them in new code.

## Public Functions

`(deprecated (6.9))` QDateTime | endOfDay(Qt::TimeSpec spec, int offsetSeconds = 0) const
`(deprecated (6.9))` QDateTime | startOfDay(Qt::TimeSpec spec, int offsetSeconds = 0) const

## Member Function Documentation

### QDateTime QDate::endOfDay(Qt::TimeSpec spec, int offsetSeconds = 0) const

This function is deprecated since 6.9. We strongly advise against using it in new code.

This is an overloaded function.

Use `endOfDay(const QTimeZone &) instead. Returns the end-moment of the day. When a day ends depends on a how time is described: each day starts and ends earlier for those with higher offsets from UTC and later for those with lower offsets from UTC. The time representation to use can be specified either by a \a spec and \a offsetSeconds (ignored unless \a spec is Qt::OffsetSeconds) or by a time zone. Usually, the end of the day is one millisecond before the midnight, 24:00: however, if a local time transition causes the given date to skip over that moment (e.g. a DST spring-forward skipping over 23:00 and the following hour), the actual latest time in the day is returned. When \a spec is Qt::OffsetFromUTC, \a offsetSeconds gives the implied zone's offset from UTC. As UTC and such zones have no transitions, the end of the day is QTime(23, 59, 59, 999) in these cases. In the rare case of a date that was entirely skipped (this happens when a zone east of the international date-line switches to being west of it), the return shall be invalid. Passing Qt::TimeZone as \a spec (instead of passing a QTimeZone) will also produce an invalid result, as shall dates that end outside the range representable by QDateTime.`

### QDateTime QDate::startOfDay(Qt::TimeSpec spec, int offsetSeconds = 0) const

This function is deprecated since 6.9. We strongly advise against using it in new code.

This is an overloaded function.

Use `startOfDay(const QTimeZone &)` instead.

Returns the start-moment of the day.

When a day starts depends on a how time is described: each day starts and ends earlier for those with higher offsets from UTC and later for those with lower offsets from UTC. The time representation to use can be specified either by a spec and offsetSeconds (ignored unless spec is Qt::OffsetSeconds) or by a time zone.

Usually, the start of the day is midnight, 00:00: however, if a local time transition causes the given date to skip over that midnight (e.g. a DST spring-forward skipping over the first hour of the day day), the actual earliest time in the day is returned.

When spec is Qt::OffsetFromUTC, offsetSeconds gives an implied zone's offset from UTC. As UTC and such zones have no transitions, the start of the day is QTime(0, 0) in these cases.

In the rare case of a date that was entirely skipped (this happens when a zone east of the international date-line switches to being west of it), the return shall be invalid. Passing Qt::TimeZone as spec (instead of passing a QTimeZone) will also produce an invalid result, as shall dates that start outside the range representable by QDateTime.