📜  SQLite日期和时间

📅  最后修改于: 2020-11-13 00:42:49             🧑  作者: Mango

日期和时间()函数

在SQLite中,date和time()函数用于检索当前日期和时间。日期和时间函数使用IS0-8601日期和时间格式的子集。

有6种不同的日期和时间函数以不同的格式返回和计算日期和时间:

  • SQLite date()函数
  • SQLite datetime()函数
  • SQLite julianday()函数
  • SQLite now()函数
  • SQLite strftime()函数
  • SQLite time()函数
Index Functions Description
1) SQLite date() function The SQLite date() function is used to calculate the date and return it in the format ‘YYYY-MM-DD’.
2) SQLite datetime() function The SQLite datetime() function is used to calculate a date/time value, and return it in the format ‘YYYY-MM-DD HH:MM:SS’.
3) SQLite julianday() function The SQLite julianday() function returns the date according to julian day. A Julian Day is the number of days since Nov 24, 4714 BC 12:00pm Greenwich time in the Gregorian calendar.
It returns the date as a floating point number.
4) SQLite now() function Actually now is not a function. Rather than it is a timestring parameter which is used in various SQLite functions to retrieve the current date and time.
5) SQLite strftime() function The SQLite strftime() function is used to return date in a formatted manner and also facilitates you to do calculation on dates.
6) SQLite time() function SQLite time() function is used to calculate time and return it in the format ‘HH-MM-SS’.