Obsolete Members for QDateTime

QDateTime 클래스의 다음 멤버는 더 이상 사용되지 않습니다. 이들은 이전 소스 코드의 작동을 유지하기 위해 제공됩니다. 새 코드에서는 사용하지 않는 것이 좋습니다.

공용 함수

(deprecated in 6.9) QDateTime(QDate date, QTime time, Qt::TimeSpec spec, int offsetSeconds = 0)
(deprecated in 6.9) void setOffsetFromUtc(int offsetSeconds)
(deprecated in 6.9) void setTimeSpec(Qt::TimeSpec spec)
(deprecated in 6.9) QDateTime toTimeSpec(Qt::TimeSpec spec) const

정적 공용 멤버

(deprecated in 6.9) QDateTime fromMSecsSinceEpoch(qint64 msecs, Qt::TimeSpec spec, int offsetSeconds = 0)
(deprecated in 6.9) QDateTime fromSecsSinceEpoch(qint64 secs, Qt::TimeSpec spec, int offsetSeconds = 0)

멤버 함수 문서

[deprecated in 6.9] QDateTime::QDateTime(QDate date, QTime time, Qt::TimeSpec spec, int offsetSeconds = 0)

이 함수는 6.9부터 더 이상 사용되지 않습니다. 새 코드에서 이 함수를 사용하지 않는 것이 좋습니다.

QDateTime(date, time) 또는 QDateTime(date, time, QTimeZone::fromSecondsAheadOfUtc(offsetSeconds)) 을 사용하세요.

specoffsetSeconds 초가 암시하는 시간 표현을 사용하여 주어진 datetime 으로 날짜 시간을 구성합니다.

date 가 유효하고 time 가 유효하지 않은 경우 시간은 자정으로 설정됩니다.

specQt::OffsetFromUTC 이 아닌 경우 offsetSeconds 는 무시됩니다. specQt::OffsetFromUTC 이고 offsetSeconds 가 0 인 경우 timeSpec()는 Qt::UTC 로 설정됩니다(즉, 오프셋 0 초).

specQt::TimeZone 인 경우 사양은 Qt::LocalTime, 즉 현재 시스템 표준 시간대로 설정됩니다. Qt::TimeZone 날짜 시간을 생성하려면 올바른 생성자를 사용합니다.

date 이 QDateTime으로 표현할 수 있는 날짜 범위를 벗어나면 결과가 유효하지 않습니다. specQt::LocalTime 이고 시스템의 표준 시간대가 지정된 날짜와 시간을 건너뛴 경우 결과는 유효하지 않습니다.

[static, deprecated in 6.9] QDateTime QDateTime::fromMSecsSinceEpoch(qint64 msecs, Qt::TimeSpec spec, int offsetSeconds = 0)

이 함수는 6.9부터 더 이상 사용되지 않습니다. 새 코드에서 이 함수를 사용하지 않는 것이 좋습니다.

이 함수는 과부하가 걸린 함수입니다.

대신 QTimeZone 를 전달하거나 specoffsetSeconds 를 생략하세요.

specoffsetSeconds 에 지정된 대로 1970년 시작 후 주어진 숫자 msecs 밀리초(UTC 기준)를 나타내는 날짜/시간을 반환합니다.

msecs 의 유효한 범위인 QDateTime 을 벗어나는 음수 및 양수 값이 있을 수 있다는 점에 유의하세요. 이 함수의 동작은 이러한 값에 대해 정의되지 않았습니다.

specQt::OffsetFromUTC 이 아닌 경우 offsetSeconds 는 무시됩니다. specQt::OffsetFromUTC 이고 offsetSeconds 가 0 인 경우 UTC 의 오프셋이 0 이므로 Qt::UTCspec 로 사용됩니다.

specQt::TimeZone 인 경우 Qt::LocalTime 가 대신 사용되며, 이는 현재 시스템 표준 시간대를 사용하는 것과 동일하지만 다르게 표시됩니다.

fromSecsSinceEpoch(), toMSecsSinceEpoch() 및 setMSecsSinceEpoch()도 참조하세요 .

[static, deprecated in 6.9] QDateTime QDateTime::fromSecsSinceEpoch(qint64 secs, Qt::TimeSpec spec, int offsetSeconds = 0)

이 함수는 6.9부터 더 이상 사용되지 않습니다. 새 코드에서 이 함수를 사용하지 않는 것이 좋습니다.

이 함수는 과부하가 걸린 함수입니다.

대신 QTimeZone 를 전달하거나 specoffsetSeconds 를 생략하세요.

specoffsetSeconds 에 지정된 대로 1970년 시작 후 주어진 숫자 secs 초(UTC 기준)의 순간을 나타내는 날짜/시간을 반환합니다.

QDateTime 의 유효한 범위를 벗어나는 secs 값은 음수와 양수 모두 가능합니다. 이 함수의 동작은 이러한 값에 대해 정의되지 않았습니다.

specQt::OffsetFromUTC 이 아닌 경우 offsetSeconds 는 무시됩니다. specQt::OffsetFromUTC 이고 offsetSeconds 가 0 인 경우 UTC 의 오프셋이 0 이므로 Qt::UTCspec 로 사용됩니다.

specQt::TimeZone 인 경우 Qt::LocalTime 가 대신 사용되며, 이는 현재 시스템 표준 시간대를 사용하는 것과 동일하지만 다르게 표시됩니다.

fromMSecsSinceEpoch(), toSecsSinceEpoch() 및 setSecsSinceEpoch()도 참조하세요 .

[deprecated in 6.9] void QDateTime::setOffsetFromUtc(int offsetSeconds)

이 함수는 6.9부터 더 이상 사용되지 않습니다. 새 코드에서 이 함수를 사용하지 않는 것이 좋습니다.

대신 setTimeZone(QTimeZone::fromSecondsAheadOfUtc(offsetSeconds))를 사용하세요.

timeSpec()를 Qt::OffsetFromUTC 으로, 오프셋을 offsetSeconds 으로 설정합니다. 날짜 시간은 다른 시점을 참조할 수 있습니다.

최대 및 최소 오프셋은 양수 또는 음수 14시간입니다. offsetSeconds 이 이보다 크거나 작으면 결과가 정의되지 않습니다.

offsetSeconds 가 0이면 timeSpec()는 Qt::UTC 로 설정됩니다.

setTimeZone(), isValid(), offsetFromUtc() 및 toOffsetFromUtc()도 참조하세요 .

[deprecated in 6.9] void QDateTime::setTimeSpec(Qt::TimeSpec spec)

이 함수는 6.9부터 더 이상 사용되지 않습니다. 새 코드에서 이 함수를 사용하지 않는 것이 좋습니다.

대신 setTimeZone()를 사용하세요.

이 날짜 시간에 사용되는 시간 사양을 spec 으로 설정합니다. 날짜 시간은 다른 시점을 참조할 수 있습니다.

specQt::OffsetFromUTC 인 경우 timeSpec()는 Qt::UTC 로 설정됩니다(즉, 유효 오프셋은 0).

specQt::TimeZone 인 경우 사양은 Qt::LocalTime, 즉 현재 시스템 표준 시간대로 설정됩니다.

예시:

QDateTime local(QDateTime::currentDateTime());qDebug() << "Local time is:" << local;

QDateTime UTC(local); UTC.setTimeSpec(Qt::UTC);qDebug() << "UTC time is:" << UTC;

qDebug() << "There are" << local.secsTo(UTC) << "seconds difference between the datetimes.";

setTimeZone(), timeSpec(), toTimeSpec(), setDate() 및 setTime()도 참조하세요 .

[deprecated in 6.9] QDateTime QDateTime::toTimeSpec(Qt::TimeSpec spec) const

이 함수는 6.9부터 더 이상 사용되지 않습니다. 새 코드에서 이 함수를 사용하지 않는 것이 좋습니다.

대신 toTimeZone()를 사용하세요.

주어진 시간으로 변환된 이 날짜/시간의 복사본을 반환합니다 spec.

결과는 이 날짜시간과 동일한 시점을 나타내며 이 날짜시간과 동일합니다.

specQt::OffsetFromUTC 인 경우 Qt::UTC 로 설정됩니다. UTC에서 고정된 오프셋으로 설정하려면 toTimeZone() 또는 toOffsetFromUtc()를 사용합니다.

specQt::TimeZone 인 경우 Qt::LocalTime, 즉 현지 표준 시간대로 설정됩니다. 지정된 표준 시간대를 설정하려면 toTimeZone()를 사용합니다.

예:

QDateTime local(QDateTime::currentDateTime());QDateTime UTC(local.toTimeSpec(Qt::UTC));qDebug() << "Local time is:" << local;
qDebug() << "UTC time is:" << UTC;
qDebug() << "No difference between times:" << local.secsTo(UTC);

setTimeSpec(), timeSpec() 및 toTimeZone()도 참조하세요 .

© 2025 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.