|
Формат даты при 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:30 |
|
Формат даты при 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:36 |
|
Формат даты при insert
|
|||
---|---|---|---|
#18+
Можно преобразовывать при вставке с помощью соотв. функции: Код: sql 1. 2.
... |
|||
:
Нравится:
Не нравится:
|
|||
29.03.2021, 15:34 |
|
Формат даты при insert
|
|||
---|---|---|---|
#18+
А лучше использовать параметры и работать с датой как с датой, а не строкой. ... |
|||
:
Нравится:
Не нравится:
|
|||
30.03.2021, 14:18 |
|
|
start [/forum/topic.php?fid=47&fpage=10&tid=1828124]: |
0ms |
get settings: |
10ms |
get forum list: |
16ms |
check forum access: |
4ms |
check topic access: |
4ms |
track hit: |
38ms |
get topic data: |
13ms |
get forum data: |
3ms |
get page messages: |
52ms |
get tp. blocked users: |
2ms |
others: | 227ms |
total: | 369ms |
0 / 0 |