Date and Time() Functions in SQLite

To get the current date and time, the date and time() functions are used in SQLite. It uses a subset of IS0-8601 date and time formats.


SQLite date() functionTo calculate the date and return it in the format ‘YYYY-MM-DD’.
SQLite datetime() functionTo calculate a date/time value, and return it in the format ‘YYYY-MM-DD HH:MM:SS’.
SQLite julianday() functionTo get the date according to julian day, which is the number of days since Nov 24, 4714 BC 12:00pm Greenwich time in the Gregorian calendar.
SQLite now() functionTime String parameter.

To retrieve the current date and time.

SQLite strftime() functionTo get date in a formatted manner.

To do calculation on dates.

SQLite time() functionTo calculate time and return it in the format ‘HH-MM-SS’.


Please Share