mirror of
https://github.com/ntop/ntopng.git
synced 2026-04-28 23:19:33 +00:00
Convert datetime to epoch in select_historical with clickhouse (#6046)
This commit is contained in:
parent
e4a6aa5be6
commit
fd61b2bb58
2 changed files with 17 additions and 0 deletions
|
|
@ -185,6 +185,13 @@ function format_utils.bitsToSize(bits)
|
|||
return(bitsToSizeMultiplier(bits, 1000))
|
||||
end
|
||||
|
||||
-- parse a SQL DATETIME date and convert to epoch
|
||||
function format_utils.parseDateTime(tstamp)
|
||||
local year, month, day, hour, min, sec = tstamp:match('^(%d+)-(%d+)-(%d+) (%d+):(%d+):(%d+)$')
|
||||
local epoch = os.time({month=month, day=day, year=year, hour=hour, min=min, sec=sec})
|
||||
return epoch
|
||||
end
|
||||
|
||||
-- format an epoch using ISO 8601 format
|
||||
function format_utils.formatEpochISO8601(epoch)
|
||||
if epoch == nil then
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue