Obsolete Members for QDateTime

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

Public Functions

(obsolete) void setTime_t (uint seconds )
(obsolete) uint toTime_t () const

Static Public Members

(obsolete) QDateTime fromTime_t (uint seconds )
(obsolete) QDateTime fromTime_t (uint seconds , Qt::TimeSpec spec , int offsetSeconds = 0)
(obsolete) QDateTime fromTime_t (uint seconds , const QTimeZone & timeZone )

Member Function Documentation

[static] QDateTime QDateTime:: fromTime_t ( uint seconds )

Returns a datetime whose date and time are the number of seconds that have passed since 1970-01-01T00:00:00, Coordinated Universal Time ( Qt::UTC ) and converted to Qt::LocalTime . On systems that do not support time zones, the time will be set as if local time were Qt::UTC .

Note: This function is deprecated. Please use fromSecsSinceEpoch () in new code.

This function was introduced in Qt 4.2.

See also toTime_t () and setTime_t ().

[static] QDateTime QDateTime:: fromTime_t ( uint seconds , Qt::TimeSpec spec , int offsetSeconds = 0)

Returns a datetime whose date and time are the number of seconds that have passed since 1970-01-01T00:00:00, Coordinated Universal Time ( Qt::UTC ) and converted to the given spec .

If the spec is not Qt::OffsetFromUTC then the offsetSeconds will be ignored. If the spec is Qt::OffsetFromUTC and the offsetSeconds is 0 then the spec will be set to Qt::UTC , i.e. an offset of 0 seconds.

Note: This function is deprecated. Please use fromSecsSinceEpoch () in new code.

This function was introduced in Qt 5.2.

See also toTime_t () and setTime_t ().

[static] QDateTime QDateTime:: fromTime_t ( uint seconds , const QTimeZone & timeZone )

Returns a datetime whose date and time are the number of seconds that have passed since 1970-01-01T00:00:00, Coordinated Universal Time ( Qt::UTC ) and with the given timeZone .

Note: This function is deprecated. Please use fromSecsSinceEpoch () in new code.

This function was introduced in Qt 5.2.

See also toTime_t () and setTime_t ().

void QDateTime:: setTime_t ( uint seconds )

Sets the date and time given the number of seconds that have passed since 1970-01-01T00:00:00, Coordinated Universal Time ( Qt::UTC ). On systems that do not support time zones this function will behave as if local time were Qt::UTC .

Note: This function is deprecated. For new code, use setSecsSinceEpoch ().

See also toTime_t ().

uint QDateTime:: toTime_t () const

Returns the datetime as the number of seconds that have passed since 1970-01-01T00:00:00, Coordinated Universal Time ( Qt::UTC ).

On systems that do not support time zones, this function will behave as if local time were Qt::UTC .

Note: This function returns a 32-bit unsigned integer and is deprecated.

If the date is outside the range 1970-01-01T00:00:00 to 2106-02-07T06:28:14, this function returns -1 cast to an unsigned integer (i.e., 0xFFFFFFFF).

To get an extended range, use toMSecsSinceEpoch () or toSecsSinceEpoch ().

See also toSecsSinceEpoch (), toMSecsSinceEpoch (), and setTime_t ().