在mysql数据库中日期与long型的转化
1、在mysql 数据库中,“2009-09-15 00:00:00”转化为列为长整型的函数:
select unix_timstamp("2009-09-15 00:00:00")*1000,
这里要注意,mysql数据库中的长整型,比java中的长整型少了秒后面的毫秒数,所以要乘以1000,这样只有几毫秒之差
2、在mysql数据库中,“1252999488000”(java中的long型数据)转化为日期:
select from_unixtime(1252999488);
注意:要将最后三位去掉
相关文档:
#include <winsock2.h>
#include <stdio.h>
#include <stdlib.h>
#include <stdarg.h>
#include <mysql.h>
#pragma comment(lib,"libmysql")
int _tmain(int argc, _TCHAR* argv[])
{
MYSQL* mysql;
MYSQL_RES* results;
MYSQL_ROW record;
mysql = mysql_init(NULL);
if(! ......
自从认识mysql的那天起就知道varchar的长度限制为255,不过现在这种情况已经改变了:
Values in VARCHAR columns are variable-length strings. The length can be specified as a value from 0 to 65,535. The effective maximum length of a VARCHAR is subject to the maximum row size (65,535 by ......
格式为2008-06-16
查询出当天数据:
SELECT * from `table` WHERE date(时间字段) = curdate();
查询出当月字段:
SELECT *
from `table`
WHERE month( 时间字段) = month( now( ) ) ;
时间格式为1219876…… UNIX时间,只要应用“from_UNIXTIME( )”函数
例如查询当月:
SELECT ......
原作:杨涛(上帝他爸)
一直想等到BETA版出来再试验的,可还是经不住诱惑阿,下午终于有时间测试一下了。
(本文参考地址:http://blog.chinaunix.net/u/8111/showart.php?id=451420)
一、必备软件:
1、LUA
可以去LUA的官方下载:www.lua.org
2、MySQL Proxy
这里有好多二进制版本。
& ......