Naja, unter Timestamp versteht man viele Schreibweisen ("01:00" ist ebenso ein Timestamp), weshalb die Frage, ob die Tagesangabe zum Timestamp dazugehört durchaus berechtigt ist.
Eine wichtige Information, die du nun genannt hast, ist, dass der Timestamp ein Unix-Timestamp - jedoch in Millisekunden - ist.
Ebenfalls eine wichtige Information, die zuvor unbekannt war.
Code: Alles auswählen
UseSQLiteDatabase()
Filename$ = GetTemporaryDirectory() + "Test.sqlite"
If CreateFile(0, Filename$)
Debug "Database file created"
CloseFile(0)
EndIf
If OpenDatabase(0, Filename$, "", "")
Debug "Connected to Test.sqlite"
If DatabaseUpdate(0, "CREATE TABLE info (timestamp TEXT, floatnumber REAL);")
Debug "Table created"
EndIf
EndIf
Debug "----------"
Date = Date()
Debug DatabaseUpdate(0, "INSERT INTO info VALUES ('" + Str(Date(Year(Date), Month(Date), 1, 0, 1, 0) * 1000) + "', '0.0');")
Debug DatabaseUpdate(0, "INSERT INTO info VALUES ('" + Str(Date(Year(Date), Month(Date), 1, 1, 0, 0) * 1000) + "', '0.5');")
Debug DatabaseUpdate(0, "INSERT INTO info VALUES ('" + Str(Date(Year(Date), Month(Date), 1, 12, 0, 0) * 1000) + "', '1.0');")
Debug DatabaseUpdate(0, "INSERT INTO info VALUES ('" + Str(Date(Year(Date), Month(Date), 1, 23, 59, 0) * 1000) + "', '1.5');")
Debug DatabaseUpdate(0, "INSERT INTO info VALUES ('" + Str(Date(Year(Date), Month(Date), 2, 5, 0, 0) * 1000) + "', '2.0');")
Debug DatabaseUpdate(0, "INSERT INTO info VALUES ('" + Str(Date(Year(Date), Month(Date), 2, 11, 0, 0) * 1000) + "', '3.5');")
Debug DatabaseUpdate(0, "INSERT INTO info VALUES ('" + Str(Date(Year(Date), Month(Date), 2, 16, 0, 0) * 1000) + "', '4.5');")
Debug DatabaseUpdate(0, "INSERT INTO info VALUES ('" + Str(Date(Year(Date), Month(Date), 2, 23, 59, 0) * 1000) + "', '6.0');")
Debug DatabaseUpdate(0, "INSERT INTO info VALUES ('" + Str(Date(Year(Date), Month(Date), 3, 1, 0, 0) * 1000) + "', '7.0');")
Debug DatabaseUpdate(0, "INSERT INTO info VALUES ('" + Str(Date(Year(Date), Month(Date), 4, 0, 1, 0) * 1000) + "', '7.1');")
Debug DatabaseUpdate(0, "INSERT INTO info VALUES ('" + Str(Date(Year(Date), Month(Date), 4, 1, 0, 0) * 1000) + "', '7.5');")
Debug DatabaseUpdate(0, "INSERT INTO info VALUES ('" + Str(Date(Year(Date), Month(Date), 5, 12, 0, 0) * 1000) + "', '8.0');")
Debug DatabaseUpdate(0, "INSERT INTO info VALUES ('" + Str(Date(Year(Date), Month(Date), 5, 23, 59, 0) * 1000) + "', '8.5');")
Debug DatabaseUpdate(0, "INSERT INTO info VALUES ('" + Str(Date(Year(Date), Month(Date), 6, 5, 0, 0) * 1000) + "', '9.0');")
Debug DatabaseUpdate(0, "INSERT INTO info VALUES ('" + Str(Date(Year(Date), Month(Date), 7, 11, 0, 0) * 1000) + "', '9.5');")
Debug DatabaseUpdate(0, "INSERT INTO info VALUES ('" + Str(Date(Year(Date), Month(Date), 8, 16, 0, 0) * 1000) + "', '10.5');")
Debug DatabaseUpdate(0, "INSERT INTO info VALUES ('" + Str(Date(Year(Date), Month(Date), 9, 23, 59, 0) * 1000) + "', '11.0');")
Debug DatabaseUpdate(0, "INSERT INTO info VALUES ('" + Str(Date(Year(Date), Month(Date), 10, 1, 0, 0) * 1000) + "', '12.0');")
Debug "----------"
If DatabaseQuery(0, "SELECT STRFTIME('%j',DATETIME(timestamp/1000,'unixepoch')) AS days, floatnumber FROM info GROUP BY days LIMIT 7")
If NextDatabaseRow(0)
Day = GetDatabaseLong(0, 0)
Debug "Tag 1 ----- " + GetDatabaseString(0, 1)
While NextDatabaseRow(0)
Debug "Tag " + Str(GetDatabaseLong(0, 0) - Day + 1) + " ----- " + GetDatabaseString(0, 1)
Wend
EndIf
EndIf
CloseDatabase(0)