SELECT
DATETIME() AS [now],
DATE() AS [today],
DATE('now', '+1 day') AS [tomorrow],
SUBSTR(DATE(), 1, 4) AS [year_only],
SUBSTR(DATE('now', '+1 year'), 1, 4) AS [next_year],
DATE(CONCAT(SUBSTR(DATE(), 1, 4), '-01-01')) AS [first_day_of_year],
DATE(CONCAT(SUBSTR(DATE('now', '+1 year'), 1, 4), '-01-01'), '-1 day') AS [last_day_of_year],
TIME('2000-01-01 00:00:00.000', '+1 hour', '+2 minute', '+5 second') AS [add_hour_min_sec],
strftime('%d-%m-%Y', DATE()) AS [day-month-YEAR],
strftime('%Y-01-01', DATE()) AS [first_day_of_year_strftime]
Функция | Схожий strftime() |
date() | strftime(‘%Y-%m-%d’, …) |
time() | strftime(‘%H:%M:%S’, …) |
datetime() | strftime(‘%Y-%m-%d %H:%M:%S’, …) |
julianday() | strftime(‘%J’, …) |
The following table shows a completed list of string formats:
Format | Description |
%d | day of the month: 01-31 |
%e | day of the month without leading zero like 1, 2, 3, … 31 |
%f | fractional seconds: SS.SSS |
%H | hour: 00-24 |
%I | hour for 12-hour clock: 01-12 |
%k | hour without leading zero: 1, 2 … 24 |
%j | day of the year: 001-366 |
%J | Julian day number |
%m | month: 01-12 |
%M | minute: 00-59 |
%s | seconds since 1970-01-01 |
%S | seconds: 00-59 |
%w | day of week 0-6 with Sunday==0 |
%W | week of the year: 00-53 |
%Y | year: 0000-9999 |
%% | % |
%p | AM or PM |
%P | am or pm |