Новые сообщения [новые:0]
Дайджест
Горячие темы
Избранное [новые:0]
Форумы
Пользователи
Статистика
Статистика нагрузки
Мод. лог
Поиск
|
29.03.2021, 13:30
|
|||
---|---|---|---|
|
|||
Формат даты при insert |
|||
#18+
Пытаюсь запросом вставить строку в таблицу. insert into exchange (currency_pair_id, de, rate, quantity, type_exchange_id) values(1,'27/03/2021 21:22', 1,1,1) Не корректно вставляется дата. Вот такое значение 0000-00-00 00:00:00. Подскажите в каком формате должна быть дата время, что бы значение корректно вставилось? ... |
|||
:
Нравится:
Не нравится:
|
|||
|
29.03.2021, 13:36
|
|||
---|---|---|---|
Формат даты при insert |
|||
#18+
set000666 Подскажите в каком формате должна быть дата время, что бы значение корректно вставилось? As a string in either 'YYYY-MM-DD hh:mm:ss' or 'YY-MM-DD hh:mm:ss' format. A “relaxed” syntax is permitted here, too: Any punctuation character may be used as the delimiter between date parts or time parts. For example, '2012-12-31 11:30:45', '2012^12^31 11+30+45', '2012/12/31 11*30*45', and '2012@12@31 11^30^45' are equivalent. The only delimiter recognized between a date and time part and a fractional seconds part is the decimal point. The date and time parts can be separated by T rather than a space. For example, '2012-12-31 11:30:45' '2012-12-31T11:30:45' are equivalent. As a string with no delimiters in either 'YYYYMMDDhhmmss' or 'YYMMDDhhmmss' format, provided that the string makes sense as a date. For example, '20070523091528' and '070523091528' are interpreted as '2007-05-23 09:15:28', but '071122129015' is illegal (it has a nonsensical minute part) and becomes '0000-00-00 00:00:00'. As a number in either YYYYMMDDhhmmss or YYMMDDhhmmss format, provided that the number makes sense as a date. For example, 19830905132800 and 830905132800 are interpreted as '1983-09-05 13:28:00'. ... |
|||
:
Нравится:
Не нравится:
|
|||
|
29.03.2021, 13:48
|
|||
---|---|---|---|
|
|||
Формат даты при insert |
|||
#18+
спасибо ... |
|||
:
Нравится:
Не нравится:
|
|||
|
29.03.2021, 15:34
|
|||
---|---|---|---|
Формат даты при insert |
|||
#18+
Можно преобразовывать при вставке с помощью соотв. функции: Код: sql 1. 2.
... |
|||
:
Нравится:
Не нравится:
|
|||
|
30.03.2021, 14:18
|
|||
---|---|---|---|
|
|||
Формат даты при insert |
|||
#18+
А лучше использовать параметры и работать с датой как с датой, а не строкой. ... |
|||
:
Нравится:
Не нравится:
|
|||
|
|
start [/forum/topic.php?fid=47&tablet=1&tid=1828124]: |
0ms |
get settings: |
10ms |
get forum list: |
12ms |
check forum access: |
3ms |
check topic access: |
3ms |
track hit: |
156ms |
get topic data: |
11ms |
get forum data: |
2ms |
get page messages: |
59ms |
get tp. blocked users: |
1ms |
others: | 249ms |
total: | 506ms |
0 / 0 |