変換時間の関数。 KingCMSでの時間処理も非常に強力です。それを見ることができます。
PHPの日付()関数はあまりにも強力です。
したがって、この関数は、2番目、2番目、addで何時間もフォーマットされていません。
<%
'****************************
'名前:時間処理機能
'関数:formatdate(str、datetime)
'パラメーター:strings、dateTime時間
著者:Xilou Lengyue
'日付:2006/1/24
'url:www.xilou.net |
'説明:返品タイプは文字列であり、時間型ではなく、エラーはfalseを返します
'****************************
function formatdate(str、datetime)
formatdate = false
isdate(datetime)= falseの場合
formatdate = false
出口機能
ifを終了します
'//年、月、週、日、時間、数分、秒
Dim Y、M、W、D、H、Min、S
'//数字と中国語の変換
dim numtocn、cnstr
cnstry |
CNSTR&THREETE -3 -1
CNSTR&30 -SIX |
CNSTR&40 -1
CNSTR = 55 |
numtocn = split(cnstr、|)
'//数字と英語の変換
Dimtoen、Ensstr
Enstr = 2月|
Ensstr = Sunday |
numtoen = split(ensst、|)
'------------------------------------------------------------- ---------------------------------
'年のプロセス、時間の時間には年を含める必要があります
'タグ:3 {ya}:2006 {yb}:06 {yc}:2006
y = year(datetime) '
if strust(str、{ya})> 0 then str = falling(str、{ya}、y) '2006
if strust(str、{yb})> 0 then str = falling(str、{yb}、right(y、2))'06
If strust(str、{yc})> 0 then
薄暗い数と中国の変換
yy = y
i = 0から9の場合
yy =置換(yy、i、numtocn(i))
次
str =置換(str、{yc}、yy) '2006
ifを終了します
'------------------------------------------------------------- ---------------------------------
'毎月の処理、時間データタイムには年と月を含める必要があります
'タグ:5 {ma}:1 {mb}:01 {mc}:a {md}:1月{me}:1月
m =月(dateTime) '月を取得します
薄暗いmm
if strust(str、{ma})> 0 then str = falling(str、{ma}、m) '1
If strust(str、{mb})> 0 then
m <10 thatn mm = 0&mの場合
str =置換(str、{mb}、mm)'01
ifを終了します
'//中国の1月
If strust(str、{mc})> 0 then
mm = m
i = 1から12の場合
mm = iの場合、mm = numtocn(i):の出口
次
str =置換(str、{mc}、mm) '
ifを終了します
'//英語1月
If strust(str、{md})> 0 then
mm = m
i = 1から12の場合
mm = iの場合、mm = numtoen(i-1):の出口
次
str =置換(str、{md}、mm)
ifを終了します
'//英語の略語1月
If strust(str、{me})> 0 then str = falling(str、{me}、left(mm、3))
'------------------------------------------------------------- -----------------------------------------------
'その過程で、時間の日付には年の年を含める必要があります
'タグ:4 {da}:1 {db}:01 {dc}:a {dd}:1st
d = day(datetime) '
DIM DD
'//番号1
If strust(str、{da})> 0 then str = cheplage(str、{da}、d)
'//番号01
If strust(str、{db})> 0 then
dd = d
dd <10 thatn dd = 0&ddの場合
str =置換(str、{db}、dd)
ifを終了します
'//中国語1
If strust(str、{dc})> 0 then
dd = d
i = 1から31の場合
dd = iの場合、dd = numtocn(i):
次
str =置換(str、{dc}、dd)
ifを終了します
'//英語24日
If strust(str、{dd})> 0 then
dd = d
ケースDDを選択します
ケース1、21、31
DD = DD&ST
ケース2、22
DD = DD&nd
ケース3、23
dd = dd&rd
ケース他のケース
dd = dd&th
[選択]を終了します
str =置換(str、{dd}、dd)
ifを終了します
'------------------------------------------------------------- -----------------------------------------------
「甘い、時間の日時は年間を含める必要があります
'タグ:4 {wa}:1 {wb}:金曜日{wc}:{wd}:tue
w =平日(生地)
薄暗いww
'//番号5
If strust(str、{wa})> 0 then str = cheplage(str、{wa}、w)
'//英語の金曜日
If strust(str、{wb})> 0 then
i = 1から7の場合
w = i then str = felpper(str、{wb}、numtoen(i+11)):
次
ifを終了します
'//中国人5
If strust(str、{wc})> 0 then
ww = w
ww = 1の場合
str =置換(str、{wc}、day)
それ以外
i = 2〜7の場合
ww = i then str = fact(str、{wc}、numtocn(i-1)):exitの場合
次
ifを終了します
ifを終了します
'//英語の略語火
If strust(str、{wd})> 0 then
i = 1から7の場合
w = iの場合、str = flact(str、{wd}、left(numtoen(i+11)、3)):
次
ifを終了します
'------------------------------------------------------------- -----------------------------------------------
「時間の時間、時間のデータは時間を含める必要があります
'ラベル:
h = hour(datetime)
薄暗いHH
formatdate = str
エンド関数
%>
<%
'例
'sub br()
'Response.Write <br/>&vbcrf
'sub
'sub out(str)
'Response.write str&vbcrlf
'br
'sub
' - - - - - - テスト
'dim s、t
's =今年は{yc} year of {yb} year {ya} year {ma} month {mb}月{mc}月{md} {me} {da} day {db} {dd day ddddd } week {wb} |。
't = now()
'out formatdate(s、t)
%>