I am trying to insert date in table in format DD.MM.YYYY, How do I do it?
Here is the code what I am trying, but there are some errors in it:
我试图以DD.MM.YYYY格式在表格中插入日期,我该怎么办?这是我正在尝试的代码,但它有一些错误:
insert into nol_art_izm([ART_ID], [DAT])
select distinct
a.ID, DATE_FORMAT({fn now()},'%d.%c.%Y')
from
openxml(@hDoc, '/art_komp/nol_art') with #artTMPL xd
join nol_art a on xd.cd = a.cd
Edit
Answer
Solved it by myself. I am inserting in DAT column with now(), but I am formatting my view column like I needed.
编辑答案由我自己解决。我使用now()插入DAT列,但我正在格式化我的视图列,就像我需要的那样。
2 个解决方案
#1
2
this should work:
这应该工作:
DATE_FORMAT(now(),'%d.%m.%Y')
#2
0
edit:
Mysql has functions to change format. I found:
Mysql具有更改格式的功能。我发现:
str_to_date('".$mydate."', '%d-%c-%Y')
#1
2
this should work:
这应该工作:
DATE_FORMAT(now(),'%d.%m.%Y')
#2
0
edit:
Mysql has functions to change format. I found:
Mysql具有更改格式的功能。我发现:
str_to_date('".$mydate."', '%d-%c-%Y')