Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
QDateTimePattern Class Reference

A description of a serialization format for a datetime. More...

#include <qttemporalpattern_p.h>

Collaboration diagram for QDateTimePattern:

Public Member Functions

bool isValid () const noexcept
void setLocale (const QLocale &loc)
const QLocalelocale () const noexcept
 Returns the current locale in use by this pattern.
void setBaseYear (int centuryStart)
void clearBaseYear () noexcept
std::optional< int > baseYear () const noexcept
void setCalendar (QCalendar cal)
QCalendar calendar () const noexcept
 Returns the current calendar in use by this pattern.
Q_CORE_EXPORT QtTemporalPattern::ParseResult< QDateTimeparse (QStringView text, const QDateTime &defaults={}) const
Q_CORE_EXPORT QString serialize (const QDateTime &datetime) const
 Serialize the given datetime to a string representation.

Static Public Member Functions

static Q_CORE_EXPORT QDateTimePattern fromQtFormat (QStringView format)
 Construct a QDateTimePattern described by the given format string.
static QDateTimePattern forLocale (const QLocale &locale, QLocale::FormatType format=QLocale::LongFormat)
 Construct a QDateTimePattern appropriate to the given locale.

Detailed Description

A description of a serialization format for a datetime.

Since
6.12

Definition at line 192 of file qttemporalpattern_p.h.

Member Function Documentation

◆ baseYear()

std::optional< int > QDateTimePattern::baseYear ( ) const
inlinenoexcept

get-base-year

Definition at line 223 of file qttemporalpattern_p.h.

◆ calendar()

QCalendar QDateTimePattern::calendar ( ) const
inlinenoexcept

Returns the current calendar in use by this pattern.

See also
setCalendar()

Definition at line 226 of file qttemporalpattern_p.h.

◆ clearBaseYear()

void QDateTimePattern::clearBaseYear ( )
inlinenoexcept

clear-base-year

Definition at line 222 of file qttemporalpattern_p.h.

◆ forLocale()

QDateTimePattern QDateTimePattern::forLocale ( const QLocale & locale,
QLocale::FormatType format = QLocale::LongFormat )
inlinestatic

Construct a QDateTimePattern appropriate to the given locale.

The format can be used to select how compact or expansive the pattern is.

See also
fromQtFormat

Definition at line 234 of file qttemporalpattern_p.h.

◆ fromQtFormat()

QDateTimePattern QDateTimePattern::fromQtFormat ( QStringView format)
static

Construct a QDateTimePattern described by the given format string.

See also
forLocale()

Definition at line 937 of file qttemporalpattern.cpp.

◆ isValid()

bool QDateTimePattern::isValid ( ) const
inlinenoexcept

{is-valid} {datetime}

base-year-disambiguates

Timezone abbreviations are ambiguous.

Definition at line 214 of file qttemporalpattern_p.h.

References QtTemporalPattern::Clear.

◆ locale()

const QLocale & QDateTimePattern::locale ( ) const
inlinenoexcept

Returns the current locale in use by this pattern.

\fn QDateTimePattern::setLocale(const QLocale &loc) noexcept

! [set-locale] Sets the locale, for use for fields whose representation depends on locale, to loc. By default the application's current default locale is used.

See also
QLocale::setDefault() ! [set-locale]
setLocale()

Definition at line 219 of file qttemporalpattern_p.h.

◆ parse()

QtTemporalPattern::ParseResult< QDateTime > QDateTimePattern::parse ( QStringView text,
const QDateTime & defaults = {} ) const
Parse and return the datetime represented by \a text.

! [parser-defaults] If defaults is provided and valid, any fields the format described by this pattern does not provide will be copied from defaults to construct the returned value. ! [parser-defaults]

Definition at line 890 of file qttemporalpattern.cpp.

◆ serialize()

QString QDateTimePattern::serialize ( const QDateTime & datetime) const

Serialize the given datetime to a string representation.

Definition at line 925 of file qttemporalpattern.cpp.

◆ setBaseYear()

void QDateTimePattern::setBaseYear ( int centuryStart)
inline

set-base-year

Definition at line 221 of file qttemporalpattern_p.h.

◆ setCalendar()

void QDateTimePattern::setCalendar ( QCalendar calendar)
inline

set-calendar

Definition at line 225 of file qttemporalpattern_p.h.

◆ setLocale()

void QDateTimePattern::setLocale ( const QLocale & loc)
inline

Definition at line 218 of file qttemporalpattern_p.h.


The documentation for this class was generated from the following files: