QString LxQtWorldClock::formatDateTime(const QDateTime &datetime, const QString &timeZoneName) { QTimeZone timeZone(timeZoneName.toLatin1()); QDateTime tzNow = datetime.toTimeZone(timeZone); QString result; switch (mFormatType) { case FORMAT_CUSTOM: result = tzNow.toString(preformat(mCustomFormat, timeZone, tzNow)); break; case FORMAT_SHORT_TIMEONLY: case FORMAT_LONG_TIMEONLY: result = tzNow.time().toString(mFormat); break; case FORMAT_SHORT: case FORMAT_LONG: result = tzNow.toString(mFormat); break; default:; } return result; }
QString LXQtWorldClock::formatDateTime(const QDateTime &datetime, const QString &timeZoneName) { QTimeZone timeZone(timeZoneName.toLatin1()); QDateTime tzNow = datetime.toTimeZone(timeZone); return tzNow.toString(preformat(mFormat, timeZone, tzNow)); }