73 QDateTime __qDateTime = QDateTime::fromTime_t( _fdValue );
74 QDate __qDate = _eUnitTimeZone ==
CUnitTimeZone::UTC ? __qDateTime.toUTC().date() : __qDateTime.toLocalTime().date();
79 return __qDate.toString(
"yyyy-MM-dd" );
82 return __qDate.toString(
"dd.MM.yyyy" );
85 return __qDate.toString(
"MM,dd,yyyy" );
101 static const QRegExp __qRegExpYMD(
"^\\s*(197\\d|19[89]\\d|[2-9]\\d\\d\\d)-(0?[1-9]|1[12])-(0?[1-9]|[12]\\d|3[01])\\s*([ZzLl])?\\s*$" );
102 static const QRegExp __qRegExpDMY(
"^\\s*(0?[1-9]|[12]\\d|3[01]).(0?[1-9]|1[12]).(197\\d|19[89]\\d|[2-9]\\d\\d\\d)\\s*([ZzLl])?\\s*$" );
103 static const QRegExp __qRegExpMDY(
"^\\s*(0?[1-9]|1[12]),(0?[1-9]|[12]\\d|3[01]),(197\\d|19[89]\\d|[2-9]\\d\\d\\d)\\s*([ZzLl])?\\s*$" );
105 if( _pbOK ) *_pbOK =
false;
106 QDateTime __qDateTime;
107 if( __qRegExpYMD.exactMatch( _rqString ) )
110 QString __qsTimeZone = __qRegExpYMD.cap(4).toUpper();
113 __qDateTime.setTimeSpec( __eUnitTimeZone ==
CUnitTimeZone::UTC ? Qt::UTC : Qt::LocalTime );
114 __qDateTime.setDate( QDate( __qRegExpYMD.cap(1).toInt(), __qRegExpYMD.cap(2).toInt(), __qRegExpYMD.cap(3).toInt() ) );
116 else if( __qRegExpDMY.exactMatch( _rqString ) )
119 QString __qsTimeZone = __qRegExpDMY.cap(4).toUpper();
122 __qDateTime.setTimeSpec( __eUnitTimeZone ==
CUnitTimeZone::UTC ? Qt::UTC : Qt::LocalTime );
123 __qDateTime.setDate( QDate( __qRegExpDMY.cap(3).toInt(), __qRegExpDMY.cap(2).toInt(), __qRegExpDMY.cap(1).toInt() ) );
125 else if( __qRegExpMDY.exactMatch( _rqString ) )
128 QString __qsTimeZone = __qRegExpMDY.cap(4).toUpper();
131 __qDateTime.setTimeSpec( __eUnitTimeZone ==
CUnitTimeZone::UTC ? Qt::UTC : Qt::LocalTime );
132 __qDateTime.setDate( QDate( __qRegExpMDY.cap(3).toInt(), __qRegExpMDY.cap(1).toInt(), __qRegExpMDY.cap(2).toInt() ) );
135 if( _pbOK ) *_pbOK =
true;
136 return( (
double)__qDateTime.toTime_t() );
[UI] Container for the application's settings
CUnitDate::EUnit getUnitDate()
[Unit] Returns the date format/unit
CUnitTimeZone::EUnit getUnitTimeZone()
[Unit] Returns the timezone format/unit
Container class for supported machine-friendly format/unit codes.
QMap< CUnitDate::EUnit, QString > qMapCodes
Container class for supported human-readable format/unit symbols.
QMap< CUnitDate::EUnit, QString > qMapSymbols
static EUnit fromCode(const QString &_rqsCode)
Returns the format/unit ID corresponding to the given machine-friendly code.
static const CUnitDateCodes oUnitDateCodes
Container for supported machine-friendly format/unit codes.
static const QMap< EUnit, QString > & symbols()
Returns the list of supported human-readable format/unit symbols.
static const CUnitDateSymbols oUnitDateSymbols
Container for supported human-readable format/unit symbols.
static const QMap< EUnit, QString > & codes()
Returns the list of supported machine-friendly format/unit codes.
static QString toString(double _fdValue, CUnitTimeZone::EUnit _eUnitTimeZone, EUnit _eUnit)
Returns the formatted represention of the given value, using the specified format/unit and decimal pr...
static double fromString(const QString &_rqString, CUnitTimeZone::EUnit _eUnitTimeZone, bool *_pbOK=0)
Returns the numeric value corresponding (parsed) from the string.
@ UNDEFINED
undefined format/unit
static QString toSymbol(EUnit _eUnit)
Returns the human-readable symbol corresponding to the given format/unit ID.
static EUnit fromSymbol(const QString &_rqsSymbol)
Returns the format/unit ID corresponding to the given human-readable symbol.
static QString toCode(EUnit _eUnit)
Returns the machine-friendly code corresponding to the given format/unit ID.
@ UTC
Universal Time Coordinates.
static CSettings * useSettings()