sql server
Create a new column (ALTER TABLE) then run an UPDATE on it. UPDATE MyTable SET NewIntColumn = DATEDIFF(SECOND, '19000101', MyDateTimeColumn).
MySQL 8.4 Reference Manual :
Given a date or datetime expr , returns the number of seconds since the year 0. If expr is not a valid date or datetime value (including NULL ), it returns NULL ... MySQL Server Time Zone... · 11.5 Expressions · 9.0
datetime (Transact-SQL) - SQL Server
Defines a date that is combined with a time of day with fractional seconds that is based on a 24-hour clock. Avoid using datetime for new work.
t sql
Use DATEPART : (DATEPART(HOUR, GETDATE()) * 3600) + (DATEPART(MINUTE, GETDATE()) * 60) + (DATEPART(SECOND, GETDATE())).
SQL Server - DATEDIFF
SQL Server DATEDIFF function returns the difference in seconds, minutes, hours, days, weeks, months, quarters and years between 2 datetime values.
how to get seconds from my time
The time string can be directly assigned to a datetime variable as 1900-01-01 20:10:10: DECLARE @time datetime = '20:10:10'.
MySQL TIME_TO_SEC() Function
The TIME_TO_SEC() function converts a time value into seconds. Syntax: TIME_TO_SEC(time) Parameter Values: Technical Details: More Examples: