日韩无码专区无码一级三级片|91人人爱网站中日韩无码电影|厨房大战丰满熟妇|AV高清无码在线免费观看|另类AV日韩少妇熟女|中文日本大黄一级黄色片|色情在线视频免费|亚洲成人特黄a片|黄片wwwav色图欧美|欧亚乱色一区二区三区

RELATEED CONSULTING
相關(guān)咨詢
選擇下列產(chǎn)品馬上在線溝通
服務(wù)時間:8:30-17:00
你可能遇到了下面的問題
關(guān)閉右側(cè)工具欄

新聞中心

這里有您想知道的互聯(lián)網(wǎng)營銷解決方案
日期轉(zhuǎn)換為中文大寫
 
 
  1. ALTER FUNCTION GetCNDay 
  2.  @dt 
  3. RETURNS Nvarchar(50) 
  4. AS 
  5. BEGIN 
  6.  DECLARE @str Nvarchar(50) -- 中間字符串,用于存儲***次轉(zhuǎn)換之后的日期字符 
  7.  DECLARE @Year Int,@Month Int,@Day Int -- 獲取函數(shù)傳入的時間參數(shù)的年月日的值 
  8.  DECLARE @strYear Nvarchar(50),@strMonth Nvarchar(50),@strDay Nvarchar(50) -- 中間字符串,分別用于存儲***次轉(zhuǎn)換之后的年月日字符串 
  9.  declare @e Nvarchar(10),@n Nvarchar(10),@index Int,@result Nvarchar(50) -- @e,@n和@index用于字符串比對,將@e中@index位置出現(xiàn)的字符替換成@n中@index位置的字符,@result用于存儲最終處理完成的日期字符串,并作為返回結(jié)果 
  10.  SELECT @e='0123456789',@n='〇一二三四五六七八九',@index=1 
  11.  SET @Year = Year(@dt) 
  12.  SET @Month = Month(@dt) 
  13.  SET @Day = Day(@dt) 
  14.  -- 生成年 
  15.  SET @strYear = Cast(@Year AS Nvarchar(50)) + '年' 
  16.  -- 生成月 
  17.  IF(@Month < 10) 
  18.  SET @strMonth = Cast(@Month AS Nvarchar(50)) 
  19.  ELSE IF(@Month = 10) 
  20.  SET @strMonth = '十' 
  21.  ELSE IF(@Month > 10) 
  22.  SET @strMonth = '十' + Cast((@Month - 10) AS Nvarchar(50)) 
  23.  SET @strMonth = @strMonth + '月' 
  24.  -- 生成日 
  25.  IF(@Day < 10) 
  26.  SET @strDay = Cast(@Day AS Nvarchar(50)) 
  27.  ELSE IF(@Day = 10) 
  28.  SET @strDay = '十' 
  29.  ELSE IF(@Day > 10 AND @Day < 20) 
  30.  SET @strDay = '十' + Cast((@Day - 10) AS Nvarchar(50)) 
  31.  ELSE IF(@Day = 20) 
  32.  SET @strDay = '二十' 
  33.  ELSE IF(@Day > 20 AND @Day < 30) 
  34.  SET @strDay = '二十' + Cast((@Day - 20) AS Nvarchar(50)) 
  35.  ELSE IF(@Day = 30) 
  36.  SET @strDay = '三十' 
  37.  ELSE IF(@Day = 31) 
  38.  SET @strDay = '三十一' 
  39.  SET @strDay = @strDay + '日' 
  40.  -- 拼接年月日 
  41.  SET @str = @strYear + @strMonth + @strDay 
  42.  WHILE @index<=Len(@str) 
  43.  BEGIN 
  44.  DECLARE @s Nvarchar(1) 
  45.  SET @s=SubString(@str,@index,1) 
  46.  IF CharIndex(@s,@e)>0 
  47.  SET @result=IsNull(@result,'')+SubString(@n,CharIndex(@s,@e),1) 
  48.  ELSE 
  49.  SET @result=IsNull(@result,'')+@s 
  50.  SET @index=@index+1 
  51.  END 
  52.  RETURN @result 
  53. END 
  54. GO 

【本文是專欄作者張勇波的原創(chuàng)文章,轉(zhuǎn)載請通過獲取作者授權(quán)】

我們提供的服務(wù)有:網(wǎng)站制作、成都網(wǎng)站設(shè)計、微信公眾號開發(fā)、網(wǎng)站優(yōu)化、網(wǎng)站認(rèn)證、五華ssl等。為上千家企事業(yè)單位解決了網(wǎng)站和推廣的問題。提供周到的售前咨詢和貼心的售后服務(wù),是有科學(xué)管理、有技術(shù)的五華網(wǎng)站制作公司


當(dāng)前題目:日期轉(zhuǎn)換為中文大寫
文章轉(zhuǎn)載:http://m.5511xx.com/article/cogeohd.html