This forum uses cookies
This forum makes use of cookies to store your login information if you are registered, and your last visit if you are not. Cookies are small text documents stored on your computer; the cookies set by this forum can only be used on this website and pose no security risk. Cookies on this forum also track the specific topics you have read and when you last read them. Please confirm that you accept these cookies being set.

filter alarm table
#3
(12.02.2021, 12:14)admin Wrote: Date/time is stored as UNIX timestamp. Check for month number wrap is not needed, it is handled by the os.time() automatically.
Code:
date = os.date('*t')
date.day, date.hour, date.min, date.sec = 1, 0, 0, 0
ts_end = os.time(date)
date.month = date.month - 1
ts_start = os.time(date)
alerts_table = db:getall('SELECT * FROM alerts where alerttime BETWEEN ? AND ? ORDER BY id DESC', ts_start, ts_end)
Keep in mind that alerts are deleted automatically, make sure that you've set the limit correctly in Utilities > General configuration.

i'm trying the code but surely i'm wrong something, the code gives me the following values for the range

From 01/01/21 to - 02/01/21

I think there is a problem with the date format , swap day and month , i have a alarm inside but return nothing to export in csv

Thank's
Reply


Messages In This Thread
filter alarm table - by Frank68 - 12.02.2021, 12:07
RE: filter alarm table - by admin - 12.02.2021, 12:14
RE: filter alarm table - by Frank68 - 12.02.2021, 12:41
RE: filter alarm table - by admin - 12.02.2021, 13:04
RE: filter alarm table - by Frank68 - 12.02.2021, 13:12
RE: filter alarm table - by admin - 12.02.2021, 13:20
RE: filter alarm table - by Frank68 - 12.02.2021, 13:35
RE: filter alarm table - by admin - 12.02.2021, 13:45
RE: filter alarm table - by Frank68 - 12.02.2021, 13:49
RE: filter alarm table - by admin - 12.02.2021, 14:00
RE: filter alarm table - by Frank68 - 12.02.2021, 14:07
RE: filter alarm table - by admin - 12.02.2021, 14:18
RE: filter alarm table - by Frank68 - 12.02.2021, 14:22
RE: filter alarm table - by admin - 12.02.2021, 14:25
RE: filter alarm table - by Frank68 - 12.02.2021, 14:30
RE: filter alarm table - by admin - 12.02.2021, 14:40
RE: filter alarm table - by Frank68 - 12.02.2021, 14:56
RE: filter alarm table - by admin - 12.02.2021, 15:14
RE: filter alarm table - by Frank68 - 12.02.2021, 15:21
RE: filter alarm table - by admin - 12.02.2021, 15:27
RE: filter alarm table - by Frank68 - 12.02.2021, 15:35
RE: filter alarm table - by admin - 12.02.2021, 15:41
RE: filter alarm table - by Frank68 - 12.02.2021, 15:56
RE: filter alarm table - by admin - 12.02.2021, 16:59
RE: filter alarm table - by Frank68 - 15.02.2021, 07:03
RE: filter alarm table - by admin - 15.02.2021, 07:49
RE: filter alarm table - by Frank68 - 15.02.2021, 08:03

Forum Jump: