der erster januar 1970 ist unixtime = 0 (zero) da bin ich mir ganz sicher..
vor dieses datum muss ich ganz sicher nicht rechnen...
aber die db MYSQL buch-haltung ist jeder eintrag in unixtime...
um zu sortieren monaten suchen ecc...
Code: Alles auswählen
uint getUnixTime(int d , int m , int j)
{
/* return 00.00 unixtime from this day */
/* d = the day as number without a leading zero (1 to 31) */
/* M = the month as number without a leading zero (1-12) */
/* yyyy = the year as four digit number (1752-8000) */
if (!d > 0 and !d < 32) {
d =1;
}
if (!m > 0 and !m < 13) {
m =1;
}
if (!j > 1969 and !j < 2016) { /* grep UPDATE_APPS */
j =1970;
}
QString CheckFinal = QString( "%1.%2.%3" ).arg( int2char(d) , int2char(m) , int2char(m) );
uint unixtime = QDateTime::fromString( CheckFinal, "d.M.yyyy" ).toTime_t();
return unixtime;
}
msgb->information( this , "Zeit result....Unix time am tag 00.00........",QString( "2,1,1970 => %1 heute 22,4,2006 = %2 " ).arg( getUnixTime(2,1,1970) , getUnixTime(22,4,2006) ) );
2,1,1970 sollte nicht mehr als 86400 sein doch die zahl ist sehr viel mehr.... da qdate zwischen 1752 und 8000 rechnet ...