Comments - working with timestamps

1 month, 1 week ago Ian Gilfillan

The DATEDIFF function requires two parameters (date or date and time) and returns a value in days of expr1-expr2, so your syntax is invalid.

You don't specify your structure, or exactly what you're trying to do, but assuming epochtime contains a unix time value, and you're just trying to return values between the two dates, something like SELECT * FROM WasserstandAllLive WHERE FROM_UNIXTIME(epochtime) BETWEEN '2024-10-19 00:00:00' AND '2024-10-20 00:00:00'; should work.

 
1 month ago Daniel Black

Or to use your index on epnochtime (hint), SELECT * FROM WasserstandAllLive WHERE epochtime BETWEEN UNIX_TIMESTAMP('2024-10-19 00:00:00') AND UNIX_TIMESTAMP('2024-10-20 00:00:00')

 
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.