Obsolete Members for QDate

以下成员源于类 QDate 被弃用。 提供它们是为使旧源代码能继续工作。强烈建议不要在新代码中使用它们。

公共函数

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

成员函数文档编制

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.

这是重载函数。

使用 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.

这是重载函数。

使用 startOfDay(const QTimeZone &) 代替。

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.

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 .