大雀软件园

首页 软件下载 安卓市场 苹果市场 电脑游戏 安卓游戏 文章资讯 驱动下载
技术开发 网页设计 图形图象 数据库 网络媒体 网络安全 站长CLUB 操作系统 媒体动画 安卓相关
当前位置: 首页 -> 技术开发 -> ASP专区 -> 一个处理各种日期格式的函数

一个处理各种日期格式的函数

时间: 2021-07-31 作者:daque

<%'----日子变化因变量----- function wf_datetochar(datetime,l)'---------证明------------'datetime是你要变化的日子值'l是你要变化到的档次,可设为"d"、"n"和"s"'"d"是指变化为yyyy-mm-dd情势'"n"是指变化为yyyy-mm-dd hh:mm情势'"s"是指变化为yyyy-mm-dd hh:mm:ss情势'"long"是指变化为yyyy年mm月dd日的情势'"no"是指变化为yyyymmdd的情势'"short"是指变化为yymmdd的情势'"t"是指变化为yymmdd hh:mm的情势'-------------------------dim ls_date,ls_getstrif isnull(l) or trim(l)="" then l="s"if isdate(datetime) thenls_date=cstr(datetime) 'writelnls_datels_getstr=datepart("yyyy",cdate(ls_date))ls_getstr=ls_getstr & "-" & wf_ctonstr(datepart("m",cdate(ls_date)),2)ls_getstr=ls_getstr & "-" & wf_ctonstr(datepart("d",cdate(ls_date)),2)if l="d" then wf_datetochar=ls_getstrls_getstr=ls_getstr & " " & wf_ctonstr(datepart("h",cdate(ls_date)),2)ls_getstr=ls_getstr & ":" & wf_ctonstr(datepart("n",cdate(ls_date)),2)if l="n" then wf_datetochar=ls_getstrls_getstr=ls_getstr & ":" & wf_ctonstr(datepart("s",cdate(ls_date)),2)if l="s" then wf_datetochar=ls_getstrif l="long" then wf_datetochar=datepart("yyyy",cdate(ls_date))&"年"&wf_ctonstr(datepart("m",cdate(ls_date)),2)&"月"&wf_ctonstr(datepart("d",cdate(ls_date)),2)&"日"if l="no" then wf_datetochar=datepart("yyyy",cdate(ls_date))&wf_ctonstr(datepart("m",cdate(ls_date)),2)&wf_ctonstr(datepart("d",cdate(ls_date)),2)if l="short" then wf_datetochar=right(datepart("yyyy",cdate(ls_date)),2)&wf_ctonstr(datepart("m",cdate(ls_date)),2)&wf_ctonstr(datepart("d",cdate(ls_date)),2)if l="t" then wf_datetochar=wf_ctonstr(datepart("m",cdate(ls_date)),2)&wf_ctonstr(datepart("d",cdate(ls_date)),2)&" "& wf_ctonstr(datepart("h",cdate(ls_date)),2)& ":" & wf_ctonstr(datepart("n",cdate(ls_date)),2)elsewf_datetochar=nullend ifend function'----把一位平头变化为两位平头----"1" to "01"function wf_ctonstr(num,n)if not isnumeric(num) thenwf_ctonstr=numelseif len(cstr(cint(num)))>=n thenwf_ctonstr=cstr(cint(num))elsewf_ctonstr="0"&cstr(cint(num))while len(wf_ctonstr)<nwf_ctonstr="0"&cstr(wf_ctonstr)wendend ifend ifend function'----------------------------------- %>

热门阅览

最新排行

Copyright © 2019-2021 大雀软件园(www.daque.cn) All Rights Reserved.