There is no need to use UTC datetime

This commit is contained in:
Debao Zhang
2013-12-27 14:59:53 +08:00
parent 07ea0d92d9
commit 8c2bac03b3
3 changed files with 15 additions and 15 deletions
+2 -2
View File
@@ -57,7 +57,7 @@ QStringList splitPath(const QString &path)
double datetimeToNumber(const QDateTime &dt, bool is1904)
{
//Note, for number 0, Excel2007 shown as 1900-1-0, which should be 1899-12-31
QDateTime epoch(is1904 ? QDate(1904, 1, 1): QDate(1899, 12, 31), QTime(0,0), Qt::UTC);
QDateTime epoch(is1904 ? QDate(1904, 1, 1): QDate(1899, 12, 31), QTime(0,0));
double excel_time = epoch.msecsTo(dt) / (1000*60*60*24.0);
if (!is1904 && excel_time > 59) {//31+28
@@ -73,7 +73,7 @@ QDateTime datetimeFromNumber(double num, bool is1904)
num = num - 1;
qint64 msecs = static_cast<qint64>(num * 1000*60*60*24.0);
QDateTime epoch(is1904 ? QDate(1904, 1, 1): QDate(1899, 12, 31), QTime(0,0), Qt::UTC);
QDateTime epoch(is1904 ? QDate(1904, 1, 1): QDate(1899, 12, 31), QTime(0,0));
return epoch.addMSecs(msecs);
}