The page provides the common SQLite datetime format strings that you can use for the datetime functions including date()
, time()
, datetime()
, and julianday()
to format the date and time:
Format | Description |
---|---|
YYYY-MM-DD | This is the standard ISO 8601 date format, where ‘YYYY’ represents the year, ‘MM’ represents the month, and ‘DD’ represents the day. |
YYYY-MM-DD HH:MM | A Julian Day number |
YYYY-MM-DD HH:MM:SS | This date format includes both date and time, separated by a space. The time includes hours, minutes, and seconds. |
YYYY-MM-DD HH:MM:SS.SSS | This date format includes both date and time, separated by a space. The time includes hours, minutes, and fractional seconds. |
YYYY-MM-DDTHH:MM | This date format includes both date and time, separated by the letter T . The time includes hours and minutes. |
YYYY-MM-DDTHH:MM:SS | This date format includes both date and time, separated by the letter T. The time includes hours, minutes, and seconds. |
YYYY-MM-DDTHH:MM:SS.SSS | This date format includes both date and time, separated by the letter T. The time includes hours, minutes, and fractional seconds. |
HH:MM | Represent a time value formatted as hours and minutes. |
HH:MM:SS | Represent a time value formatted as hours, minutes, and seconds. |
HH:MM:SS.SSS | Represent a time value formatted as hours, minutes, and fractional seconds. |
now | Represent the current time. |
DDDDDDDDDD | This date format includes both date and time, separated by the letter T. The time includes hours and minutes. |
Was this tutorial helpful ?