亚洲乱码中文字幕综合,中国熟女仑乱hd,亚洲精品乱拍国产一区二区三区,一本大道卡一卡二卡三乱码全集资源,又粗又黄又硬又爽的免费视频

ms sql server中實(shí)現(xiàn)的unix時(shí)間戳函數(shù)(含生成和格式化,可以和mysql兼容)

 更新時(shí)間:2014年07月03日 10:56:04   投稿:junjie  
這篇文章主要介紹了ms sql server中實(shí)現(xiàn)的unix時(shí)間戳函數(shù),含生成和格式化UNIX_TIMESTAMP、from_unixtime兩個(gè)函數(shù),可以和mysql兼容,需要的朋友可以參考下

直接上代碼:

CREATE FUNCTION UNIX_TIMESTAMP (@ctimestamp datetime) RETURNS integer 
AS
BEGIN
 /* Function body */
 declare @return integer
 SELECT @return = DATEDIFF(SECOND,{d '1970-01-01'}, @ctimestamp)
 return @return
END


CREATE FUNCTION from_unixtime (@ts integer) RETURNS datetime 
AS
BEGIN
 /* Function body */
 declare @return datetime
 select @return = DATEADD(second, @ts, {d '1970-01-01'})
 return @return
END

用法

跟MySQL下的一樣類似:

select dbo.UNIX_TIMESTAMP('2013-1-1')
select dbo.from_unixtime(2145000000)

相關(guān)文章

最新評(píng)論