mysql数据库时间函数
在mysql中可以调用哪个时间函数获得当前的时间格式为:yyyy-MM-dd hh:mm:ss格式的,我查了好些都不尽人意,请大家帮忙提示一下
SQL code:
mysql> select date_format(now(),'%Y-%m-%d %H:%i:%s');
+----------------------------------------+
| date_format(now(),'%Y-%m-%d %H:%i:%s') |
+----------------------------------------+
| 2009-12-28 21:21:42 |
+----------------------------------------+
1 row in set (0.00 sec)
mysql>
select now();
嗯,是的啊,不过我的mysql中使用select now();却获取不到这种格式的效果,请问是什么原因啊?
你用一楼的方法显示得是什么?
另外检查一下你的系统变量
SQL code:
mysql> show variables like '%time_format%';
+-----------------+-------------------+
| Variable_name | Value |
+-----------------+-------------------+
| datetime_format | %Y-%m-%d %H:%i:%s |
| time_format | %H:%i:%s |
+-----------------+-------------------+
2 rows in set (0.00 sec)
mysql>
select date_format(now(),'%Y-%m-%d %H:%i:%s');
佩服ACMAIN_CHM!
相关问答:
我是用mysql自带的C API
if(mysql_real_connect(&mysql,"125.0.0.108","root","root","home",3306,NULL,0))
{
AfxMessageBox("数据库连接失败") ......
要转成一样的效果,用powerdesigner怎么转?能转吗?
create table publishers (
publisherID int identity,
publisherName varchar (30) NOT NULL,
constraint pk_publishers primary key (publisherID)
)& ......
大家帮我看下吧,本来数据库没有东西,能显示没有东西的信息,但是我添加了一条内容后,字没了,但是图片也无法显示,红叉叉也没有,怎么回事啊?
PHP code:
<?php
$str="select * from product wh ......
String SQL="insert into 学生信息表 values(StudentNumber,StudentName,StudentAge)";其中StudentNumber,StudentName,StudentAge都是变量。这样写不对……到底该咋写啊
万分感谢!
String SQL=&q ......
CREATE DATABASE ADDRESSLIST;
USE ADDRESSLIST;
DROP TABLE IF EXISTS FRIEND;
CREATE TABLE FRIEND
(FRIEND_ID INTEGER NOT NULL AUTO_INCREMENT PRIMARY KEY ,
FRIEND_NAME VARCHAR(20) NOT N ......