将今天的日期放入MySQL“日期”中。形成的领域 [英] Put today's date into a MySQL "date" formated field

查看:81
本文介绍了将今天的日期放入MySQL“日期”中。形成的领域的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的MySQL表有一个字段设置为类型日期。今天我需要获得

的日期,并将其插入该字段。该MySQL

字段的默认值是2006-00-00。


我知道date()函数。我已经尝试过日期(Y-m-d)和

日期(U),但都没有奏效。日期字段刚刚提交所有

零。


有人能指出我正确的方向吗?


Thanx。

解决方案

walterbyrd< wa ******** @ iname.comwrote:
< blockquote class =post_quotes>
我的MySQL表有一个字段设置为类型date。今天我需要获得

的日期,并将其插入该字段。该MySQL

字段的默认值是2006-00-00。


我知道date()函数。我已经尝试过日期(Y-m-d)和

日期(U),但都没有奏效。日期字段刚刚提交所有

零。


有人能指出我正确的方向吗?


Thanx。



现在()


彼得


-
http://www.boosten.org


邮件:peter at boosten dot org




Peter Boosten写道:


>

now()



根据php.net:抱歉,但现在该功能不在

在线手册。


这是实际代码:


这*将*工作:


mysql_query(" INSERT INTO inventory(item_num,location,quantity,

date_modified)VALUES(


row [0],''FLR'',

My MySQL table has a field that is set as type "date." I need to get
today''s date, and insert it into that field. The default for that MySQL
field is 2006-00-00.

I know about the date() function. I have tried date("Y-m-d") and
date("U"), neither worked. The date field was just filed with all
zeros.

Can anybody point me in the right direction?

Thanx.

解决方案

walterbyrd <wa********@iname.comwrote:

My MySQL table has a field that is set as type "date." I need to get
today''s date, and insert it into that field. The default for that MySQL
field is 2006-00-00.

I know about the date() function. I have tried date("Y-m-d") and
date("U"), neither worked. The date field was just filed with all
zeros.

Can anybody point me in the right direction?

Thanx.

now()

Peter

--
http://www.boosten.org

Mail: peter at boosten dot org



Peter Boosten wrote:

>
now()

According to php.net: "Sorry, but the function now is not in the
online manual. "

Here is the actual code:

This *will* work:

mysql_query("INSERT INTO inventory (item_num, location, quantity,
date_modified) VALUES(


row[0], ''FLR'',


这篇关于将今天的日期放入MySQL“日期”中。形成的领域的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆