以文本方式查看主题 - 智睿软件_技术交流论坛 (http://zhirui.net/bbs/index.asp) -- Web程序开发 (http://zhirui.net/bbs/list.asp?boardid=22) ---- [推荐]Sql时间函数 (http://zhirui.net/bbs/dispbbs.asp?boardid=22&id=15) |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
-- 作者:zhirui -- 发布时间:2009-09-08 17:11:10 -- [推荐]Sql时间函数 一、sql server日期时间函数 ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() 二、日期格式转换 举例:select CONVERT(varchar, getdate(), 120 ) ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() 1.GetDate() 用于sql server :select GetDate() 2.DateDiff(\'s\',\'2005-07-20\',\'2005-7-25 22:56:32\')返回值为 514592 秒 DateDiff(\'d\',\'2005-07-20\',\'2005-7-25 22:56:32\')返回值为 5 天 3.DatePart(\'w\',\'2005-7-25 22:56:32\')返回值为 2 即星期一(周日为1,周六为7) DatePart(\'d\',\'2005-7-25 22:56:32\')返回值为 25即25号 DatePart(\'y\',\'2005-7-25 22:56:32\')返回值为 206即这一年中第206天 DatePart(\'yyyy\',\'2005-7-25 22:56:32\')返回值为 2005即2005年 附图
参数 interval的设定值如下:
|