Converting unix timestamp to SQL datetime format is straightforward. You only need to add the timestamp value (as seconds) to the epoch date ‘1970-01-01 00:00:00’. You can do this with the “DATE_ADD” command in MySQL or “DATEADD” in SQL server:
In SQL server:
SELECT DATEADD(SECOND, timestamp, '1970-01-01 00:00:00') AS visit_datetime;
Mysql requires that timestamp be converted to integer:
SELECT DATE_ADD('1970-01-01 00:00:00', INTERVAL CAST(timestamp AS UNSIGNED) SECOND) AS visit_datetime
Note that you probably need backticks around timestamp (not shown here)