44 #include <QtCore/qstring.h>
45 #include <QtCore/qnamespace.h>
46 #include <QtCore/qshareddata.h>
47 #include <QtCore/qcalendar.h>
51 #if defined(Q_OS_DARWIN) || defined(Q_QDOC)
58 #if QT_CONFIG(timezone)
65 explicit constexpr
QDate(
qint64 julianDay) : jd(julianDay) {}
67 constexpr
QDate() : jd(nullJd()) {}
71 constexpr
bool isNull()
const {
return !isValid(); }
72 constexpr
bool isValid()
const {
return jd >= minJd() && jd <= maxJd(); }
78 int dayOfWeek()
const;
79 int dayOfYear()
const;
80 int daysInMonth()
const;
81 int daysInYear()
const;
82 int weekNumber(
int *yearNum =
nullptr)
const;
94 #if QT_CONFIG(timezone)
99 #if QT_CONFIG(datestring)
101 # if QT_STRINGVIEW_LEVEL < 2
107 bool setDate(
int year,
int month,
int day);
108 bool setDate(
int year,
int month,
int day,
QCalendar cal);
110 void getDate(
int *year,
int *month,
int *day)
const;
114 [[nodiscard]]
QDate addMonths(
int months)
const;
115 [[nodiscard]]
QDate addYears(
int years)
const;
121 #if QT_CONFIG(datestring)
124 {
return fromString(
string.toString(),
format, cal); }
126 # if QT_STRINGVIEW_LEVEL < 2
134 static bool isValid(
int y,
int m,
int d);
135 static bool isLeapYear(
int year);
138 {
return jd_ >= minJd() && jd_ <= maxJd() ?
QDate(jd_) :
QDate() ; }
143 static constexpr
inline qint64 nullJd() {
return (std::numeric_limits<qint64>::min)(); }
144 static constexpr
inline qint64 minJd() {
return Q_INT64_C(-784350574879); }
145 static constexpr
inline qint64 maxJd() {
return Q_INT64_C( 784354017364); }
158 #ifndef QT_NO_DATASTREAM
167 explicit constexpr
QTime(
int ms) : mds(
ms)
174 constexpr
bool isNull()
const {
return mds == NullTime; }
175 bool isValid()
const;
181 #if QT_CONFIG(datestring)
183 #if QT_STRINGVIEW_LEVEL < 2
189 bool setHMS(
int h,
int m,
int s,
int ms = 0);
191 [[nodiscard]]
QTime addSecs(
int secs)
const;
192 int secsTo(
QTime t)
const;
193 [[nodiscard]]
QTime addMSecs(
int ms)
const;
194 int msecsTo(
QTime t)
const;
200 #if QT_CONFIG(datestring)
203 {
return fromString(
string.toString(),
format); }
205 # if QT_STRINGVIEW_LEVEL < 2
212 static bool isValid(
int h,
int m,
int s,
int ms = 0);
215 enum TimeFlag { NullTime = -1 };
216 constexpr
inline int ds()
const {
return mds == -1 ? 0 : mds; }
228 #ifndef QT_NO_DATASTREAM
240 #if Q_BYTE_ORDER == Q_LITTLE_ENDIAN
243 #if QT_VERSION >= QT_VERSION_CHECK(7,0,0)
247 qintptr msecs :
sizeof(
void *) * 8 - 8;
250 #if Q_BYTE_ORDER == Q_BIG_ENDIAN
273 bool isShort()
const;
286 #if QT_CONFIG(timezone)
299 bool isValid()
const;
304 int offsetFromUtc()
const;
305 #if QT_CONFIG(timezone)
308 QString timeZoneAbbreviation()
const;
309 bool isDaylightTime()
const;
311 qint64 toMSecsSinceEpoch()
const;
312 qint64 toSecsSinceEpoch()
const;
317 void setOffsetFromUtc(
int offsetSeconds);
318 #if QT_CONFIG(timezone)
319 void setTimeZone(
const QTimeZone &toZone);
321 void setMSecsSinceEpoch(
qint64 msecs);
322 void setSecsSinceEpoch(
qint64 secs);
324 #if QT_CONFIG(datestring)
326 # if QT_STRINGVIEW_LEVEL < 2
333 [[nodiscard]]
QDateTime addMonths(
int months)
const;
334 [[nodiscard]]
QDateTime addYears(
int years)
const;
341 QDateTime toOffsetFromUtc(
int offsetSeconds)
const;
342 #if QT_CONFIG(timezone)
352 #if QT_CONFIG(datestring)
356 {
return fromString(
string.toString(),
format, cal); }
359 # if QT_STRINGVIEW_LEVEL < 2
369 int offsetFromUtc = 0);
371 int offsetFromUtc = 0);
373 #if QT_CONFIG(timezone)
379 static
qint64 currentSecsSinceEpoch() noexcept;
381 #if defined(Q_OS_DARWIN) || defined(Q_QDOC)
406 #ifndef QT_NO_DATASTREAM
411 #if !defined(QT_NO_DEBUG_STREAM) && QT_CONFIG(datestring)
417 #ifndef QT_NO_DATASTREAM
426 #if !defined(QT_NO_DEBUG_STREAM) && QT_CONFIG(datestring)
435 Q_CORE_EXPORT
size_t qHash(
QDate key,
size_t seed = 0) noexcept;
436 Q_CORE_EXPORT
size_t qHash(
QTime key,
size_t seed = 0) noexcept;
The QCalendar class describes calendar systems.
The QDataStream class provides serialization of binary data to a QIODevice.
operator>>(QDataStream &ds, qfloat16 &f)
operator<<(QDataStream &ds, qfloat16 f)
The QDate class provides date functions.
constexpr bool isValid() const
constexpr qint64 toJulianDay() const
static constexpr QDate fromJulianDay(qint64 jd_)
constexpr bool isNull() const
constexpr friend bool operator!=(QDate lhs, QDate rhs)
constexpr friend bool operator>=(QDate lhs, QDate rhs)
static QDate currentDate()
constexpr friend bool operator<=(QDate lhs, QDate rhs)
constexpr friend bool operator==(QDate lhs, QDate rhs)
The QDateTime class provides date and time functions.
static QDateTime currentDateTime()
friend bool operator>(const QDateTime &lhs, const QDateTime &rhs)
friend bool operator<=(const QDateTime &lhs, const QDateTime &rhs)
friend bool operator!=(const QDateTime &lhs, const QDateTime &rhs)
friend bool operator>=(const QDateTime &lhs, const QDateTime &rhs)
QDateTime toLocalTime() const
friend bool operator==(const QDateTime &lhs, const QDateTime &rhs)
static QDateTime currentDateTimeUtc()
static qint64 currentMSecsSinceEpoch() noexcept
friend bool operator<(const QDateTime &lhs, const QDateTime &rhs)
void swap(QDateTime &other) noexcept
The QDebug class provides an output stream for debugging information.
template< typename Enum > size_t qHash(QFlags< Enum > flags, size_t seed=0) noexcept
The QString class provides a Unicode character string.
The QStringView class provides a unified view on UTF-16 strings with a read-only subset of the QStrin...
The QTime class provides clock time functions.
constexpr friend bool operator<=(QTime lhs, QTime rhs)
constexpr bool isNull() const
static QTime currentTime()
constexpr friend bool operator==(QTime lhs, QTime rhs)
constexpr friend bool operator!=(QTime lhs, QTime rhs)
static constexpr QTime fromMSecsSinceStartOfDay(int msecs)
constexpr int msecsSinceStartOfDay() const
constexpr friend bool operator>=(QTime lhs, QTime rhs)
The QTimeZone class converts between UTC and local time in a specific time zone.
auto it unsigned count const
QT_BEGIN_NAMESPACE bool operator<(const QMimeType &t1, const QMimeType &t2)
void toString(QString &appendTo, IPv4Address address)
std::chrono::milliseconds ms
void swap(SimpleVector< T > &v1, SimpleVector< T > &v2)
#define Q_DECL_NS_RETURNS_AUTORELEASED
#define Q_DECL_CF_RETURNS_RETAINED
Q_FORWARD_DECLARE_OBJC_CLASS(NSObject)
Q_FORWARD_DECLARE_CF_TYPE(CTFontDescriptor)
QDateTimePrivate::QDateTimeShortData ShortData
Q_DECLARE_TYPEINFO(QDate, Q_RELOCATABLE_TYPE)
Q_CORE_EXPORT QDataStream & operator>>(QDataStream &, QDate &)
Q_CORE_EXPORT QDataStream & operator<<(QDataStream &, QDate)
constexpr bool operator>(const QFixed &f, int i)
#define QT_MOVE_ASSIGNMENT_OPERATOR_IMPL_VIA_PURE_SWAP(Class)
GLint GLsizei GLsizei GLenum GLenum GLsizei void * data
GLint GLsizei GLsizei GLenum format
GLfloat GLfloat GLfloat GLfloat h
QStringView qToStringViewIgnoringNull(const QStringLike &s) noexcept
#define Q_DECLARE_SHARED(TYPE)