Time String Format
DATE() function is used with datetime expressions which can be represented in various formats. The time string format refers to the specific structure used to represent time-related data within datetime expressions.
Common time string formats defined below in the table:
Format |
Description |
Example |
Notes |
---|---|---|---|
‘HH:MM’ |
Hours and minutes in 24-hour format |
’14:30′ |
It Represents time with precision to minutes. |
‘HH:MM:SS’ |
Hours, minutes, and seconds in 24-hour format |
14:30:00′ |
It Represents time with precision to seconds. |
‘HH:MM:SS.SSS’ |
Hours, minutes, seconds, and milliseconds |
’14:30:00.000′ |
It Represents time with precision to milliseconds. |
‘now’ |
Current date and time |
‘2024-02-08 14:30:00’ |
It Returns the timestamp when the query is executed. |
DDDDDDDDDD |
Number of days since 0000-01-01 |
737825 |
It Represents the days elapsed since the reference. |
‘YYYY-MM-DD HH:MM’ |
Date and time in ISO format with minutes |
‘2024-02-08 14:30’ |
It Represents date and time with minute precision. |
‘YYYY-MM-DD’ |
Date in year-month-day format |
‘2024-02-08’ |
It Represents date in year, month, and day format. |
‘YYYY-MM’ |
Date in year-month format |
‘2024-02’ |
It Represents date in year and month format. |
These time string formats enable precise representation and manipulation of time-related data within SQLite queries
SQLite DATE Function
In SQLite database management the DATE() function is useful for handling date and time data very effectively. This function fasts the extraction of the date part from a datetime expression or conversion of a text representation of a date in date format.
In this article, we will learn about the DATE() Function to understand along with its syntax, various examples, and so on.