SQLite time() function
Description
SQLite TIME() extracts the time part of a time or datetime expression as string format.
The time() function returns the time as HH:MM:SS.
Syntax:
time(timestring, modifier, modifier, ...)
Example-1:
If you want to get the current time the following SQL can be used.
SELECT time('now') as "Current Time";
or
SELECT time() as "Current Time";
Here is the result.
Current Time ------------ 10:37:30
Example-2:
The following statement will return the time portion from the given date-time value 2014-10-07 15:45:57.005678.
SELECT time('2014-10-07 15:45:57.005678') as "Only time part";
Here is the result.
Only time part -------------- 15:45:57
Example-3:
If you want to get the time after 15 minutes from the current time, the following SQL can be used.
SELECT TIME('now'),TIME('now','+15 minutes');
Here is the result.
TIME('now') TIME('now','+15 minutes') ----------- ------------------------- 11:22:26 11:37:26
Example-4:
If you want to get the time after 60 seconds from the current time the following SQL can be used.
SELECT TIME('now'),TIME('now','+60 seconds');
Here is the result.
TIME('now') TIME('now','+60 seconds') ----------- ------------------------- 11:24:14 11:25:14
It will be nice if you may share this link in any developer community or anywhere else, from where other developers may find this content. Thanks.
https://w3resource.com/sqlite/sqlite-time.php
- Weekly Trends and Language Statistics
- Weekly Trends and Language Statistics