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)) 를 사용하십시오.

주어진 date 및 time 를 사용하여, spec 및 offsetSeconds 초에 의해 암시되는 시간 표현 방식을 바탕으로 datetime 객체를 생성합니다.

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

spec 가 Qt::OffsetFromUTC 와 다를 경우, offsetSeconds 는 무시됩니다. spec 가 Qt::OffsetFromUTC 이고 offsetSeconds 가 0인 경우, timeSpec()는 Qt::UTC, 즉 0초의 오프셋으로 설정됩니다.

spec 가 Qt::TimeZone 인 경우, spec은 Qt::LocalTime 로 설정되며, 이는 현재 시스템 시간대를 의미합니다. Qt::TimeZone 형식의 날짜/시간 객체를 생성하려면 올바른 생성자를 사용하십시오.

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

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

이 함수는 6.9 버전부터 더 이상 권장되지 않습니다. 새로운 코드에서는 이 함수를 사용하지 않는 것을 강력히 권장합니다.

대신 ` QTimeZone `를 전달하거나, ` spec ` 및 ` offsetSeconds`를 생략하십시오.

spec 및 offsetSeconds 에 지정된 대로, 1970년 시작 시점(UTC)으로부터 주어진 밀리초 수 msecs 만큼 지난 시점을 나타내는 datetime을 반환합니다.

msecs 의 값 중 QDateTime 에서 정의한 유효한 범위(양수 및 음수 모두)를 벗어날 수 있다는 점에 유의하십시오. 이러한 값에 대해서는 이 함수의 동작이 정의되지 않습니다.

spec 가 Qt::OffsetFromUTC 와 다를 경우, offsetSeconds 는 무시됩니다. spec 가 Qt::OffsetFromUTC 이고 offsetSeconds 가 0인 경우, UTC의 오프셋이 0이므로 Qt::UTC 가 spec 로 사용됩니다.

spec 가 Qt::TimeZone 인 경우, Qt::LocalTime 가 대신 사용되며, 이는 현재 시스템 시간대를 사용하는 것과 동일합니다(단, 표현 방식만 다릅니다).

이 함수는 QDateTime::fromMSecsSinceEpoch()을 오버로드합니다.

fromSecsSinceEpoch(), toMSecsSinceEpoch(), setMSecsSinceEpoch()도 참조하십시오 .

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

이 함수는 6.9 버전부터 더 이상 사용되지 않습니다. 새로운 코드에서는 이 함수를 사용하지 않는 것을 강력히 권장합니다.

대신 ` QTimeZone `를 전달하거나, ` spec ` 및 ` offsetSeconds`를 생략하십시오.

spec 및 offsetSeconds 에 지정된 대로, 1970년 시작 시점(UTC)으로부터 주어진 초 수 secs 만큼 지난 시점을 나타내는 datetime을 반환합니다.

secs 의 값 중 QDateTime 에서 정의한 유효 범위를 벗어난 값(음수 및 양수 모두)이 있을 수 있습니다. 이러한 값에 대해서는 이 함수의 동작이 정의되지 않습니다.

spec 가 Qt::OffsetFromUTC 와 다를 경우, offsetSeconds 는 무시됩니다. spec 가 Qt::OffsetFromUTC 이고 offsetSeconds 가 0인 경우, UTC는 오프셋이 0이므로 Qt::UTC 가 spec 로 사용됩니다.

spec 가 Qt::TimeZone 인 경우, Qt::LocalTime 가 대신 사용되며, 이는 현재 시스템 시간대를 사용하는 것과 동일합니다(단, 표현 방식이 다를 뿐입니다).

이 함수는 QDateTime::fromSecsSinceEpoch 를 오버로드합니다.

fromMSecsSinceEpoch(), toSecsSinceEpoch(), setSecsSinceEpoch()도 참조하십시오 .

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

이 함수는 6.9 버전부터 더 이상 권장되지 않습니다. 새로운 코드에서는 이 함수를 사용하지 않는 것을 강력히 권장합니다.

대신 ` setTimeZone(QTimeZone::fromSecondsAheadOfUtc(offsetSeconds))`를 사용하십시오.

timeSpec()를 Qt::OffsetFromUTC 로, 오프셋을 offsetSeconds 로 설정합니다. datetime은 다른 시점을 가리킬 수 있습니다.

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

offsetSeconds 가 0인 경우, timeSpec()은 Qt::UTC 로 설정됩니다.

setTimeZone(), isValid(), offsetFromUtc(), toOffsetFromUtc()도 참조하십시오 .

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

이 함수는 6.9 버전부터 더 이상 사용되지 않습니다. 새로운 코드에서는 이 함수를 사용하지 않는 것을 강력히 권장합니다.

대신 ` setTimeZone()`를 사용하십시오.

이 datetime에 사용되는 시간 표기법을 spec 로 설정합니다. datetime은 다른 시점을 가리킬 수 있습니다.

spec 가 Qt::OffsetFromUTC 인 경우, timeSpec()는 Qt::UTC 로 설정되며, 이는 실효 오프셋이 0임을 의미합니다.

spec 가 Qt::TimeZone 인 경우, spec은 Qt::LocalTime 로 설정되며, 이는 현재 시스템 시간대를 의미합니다.

예시:

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

QDateTime UTC(현지 시간);
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()`를 사용하십시오.

이 datetime 객체의 복사본을 반환하며, 이 복사본은 지정된 시간 spec 로 변환된 값입니다.

결과는 이 datetime과 동일한 시점을 나타내며, 이 datetime과 동일합니다.

spec 가 Qt::OffsetFromUTC 인 경우, Qt::UTC 로 설정됩니다. UTC로부터 고정된 오프셋으로 설정하려면 toTimeZone() 또는 toOffsetFromUtc()을 사용하십시오.

spec 가 Qt::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()도 참조하십시오 .

© 2026 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.