怎样把2004-2-12 12:30:18 这样的格式转换为20040212123018

yx360 2004-11-27 02:35:07
rt,转换为字符串型
...全文
105 8 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
8 条回复
切换为时间正序
请发表友善的回复…
发表回复
yx360 2004-11-27
  • 打赏
  • 举报
回复
to hedongyang(笑笑) and xiaozx(老德)
你们的方法不能把1位的月份转换为2位的,不过还是要谢谢你们
waiber 2004-11-27
  • 打赏
  • 举报
回复
'晕 忘补0,加上!

function ConvDateTimeAll(StrDateTimeAll)
dim strYear,strMonth,strDay
dim strHour,strMin,strSec

strYear = Year(StrDateTimeAll)
strMonth = Month(StrDateTimeAll)
if len(strMonth)=1 then
strMonth="0" & strMonth
end if
strDay = day(StrDateTimeAll)
if len(strDay)=1 then
strDay ="0" & strDay
end if
strHour = hour(StrDateTimeAll)
if len(strHour)=1 then
strHour ="0" & strHour
end if
strMin = Minute(StrDateTimeAll)
if len(strMin)=1 then
strMin="0" & strMin
end if
strSec = Second(StrDateTimeAll)
if len(strSec)=1 then
strSec="0" & strSec
end if

ConvDateTimeAll = strYear&strMonth&strDay&strHour&strMin&strSec
end function

Response.Write(ConvDateTimeAll(Now()))
waiber 2004-11-27
  • 打赏
  • 举报
回复
function ConvDateTimeAll(StrDateTimeAll)
dim strYear,strMonth,strDay
dim strHour,strMin,strSec

strYear = Year(StrDateTimeAll)
strMonth = Month(StrDateTimeAll)
strDay = day(StrDateTimeAll)
strHour = hour(StrDateTimeAll)
strMin = Minute(StrDateTimeAll)
strSec = Second(StrDateTimeAll)

ConvDateTimeAll = strYear&strMonth&strDay&strHour&strMin&strSec
end function

Response.Write(ConvDateTimeAll(Now()))
Camelot 2004-11-27
  • 打赏
  • 举报
回复
Function timecode(tstr)
timecode=Year(tstr)
if Month(tstr)<10 then timecode=timecode &"0"
timecode=timecode & Month(tstr)
if Day(tstr)<10 then timecode=timecode &"0"
timecode=timecode & Day(tstr)
if Hour(tstr)< 10 then timecode=timecode &"0"
timecode=timecode & Hour(tstr)
if Minute(tstr)<10 then timecode=timecode &"0"
timecode=timecode & Minute(tstr)
if Second(tstr)<10 then timecode=timecode &"0"
timecode=timecode & Second(tstr)
end Function


用上面这个函数,
如Response.Write(timecode(Now()))





┏━━━.:可爱的分割线:.━━━━━━━━━━━━━━━━
┃                                
┃在线的RSS订阅系统(Blog、新闻、技术):http://www.gbmad.net/rss/
┃无论你在哪,只要能上网就能订阅查看你喜欢的聚合         
┃                                
┗━━━━━━━━━━━━━━━━━━━━━━━━━━━
phckt 2004-11-27
  • 打赏
  • 举报
回复
fname = now()
fname = replace(fname,"-","")
fname = replace(fname," ","")
fname = replace(fname,":","")
fname = replace(fname,"PM","")
fname = replace(fname,"AM","")
fname = replace(fname,"上午","")
fname = replace(fname,"下午","")
xiaozx 2004-11-27
  • 打赏
  • 举报
回复
aa=replace(aa," ","")
aa=replace(aa,"-","")
aa=replace(aa,":","")
hedongyang 2004-11-27
  • 打赏
  • 举报
回复
Dim dd,dd1
dd=Now()

dd1=Replace(dd,"-","")
dd1=Replace(dd1," ","")
dd1=Replace(dd1,":","")

Response.Write(dd1)
yx360 2004-11-27
  • 打赏
  • 举报
回复
up

28,409

社区成员

发帖
与我相关
我的任务
社区描述
ASP即Active Server Pages,是Microsoft公司开发的服务器端脚本环境。
社区管理员
  • ASP
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧