请教各位一个时期转换问题!!

nnyyang 2005-01-26 05:10:45
我用的是ACCESS数据库,在数据库一个表中建立一个日期类型的字段(如:2005-1-26 14:44:48),用ASP的recordset对象调用出来,格式却显示为:Wed Jan 26 14:44:48 UTC+0800 2005,请问如何将它转换为yyyy-mm-dd的格式
...全文
85 7 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
7 条回复
切换为时间正序
请发表友善的回复…
发表回复
nnyyang 2005-01-27
  • 打赏
  • 举报
回复
不行得嘛????
我用javascript写的!
var str_date=rs("date")
Response.Write(str_date.getYear() + "-" + str_date.getMonth() + "-" + str_date.getDay());
提示:对象不支持此属性或方法!!!
FormatDateTime(rs("date"),vbShortDate)
这个方法也不行,提示,缺少对象!!!

怎么办??
hushuang7094 2005-01-26
  • 打赏
  • 举报
回复
FormatDateTime(rs("date"),2)
flashasp 2005-01-26
  • 打赏
  • 举报
回复
<%

Function DateToString(sDate)
Dim sYear,sMonth,sDay
sYear = Cstr(Year(Cdate(sDate)))
sMonth = Right("0" & Cstr(Month(Cdate(sDate))),2)
sDay = Right("0" & Cstr(Day(Cdate(sDate))),2)
DateToString = sYear & "-"&sMonth &"-" & sDay
End Function
dat="2005-1-26 14:44:48"
response.write DateToString(dat)
%>
「已注销」 2005-01-26
  • 打赏
  • 举报
回复
js:
Response.Write str_date.getYear() + "-" + str_date.getMonth() + "-" + str_date.getDay()
myvicy 2005-01-26
  • 打赏
  • 举报
回复
FormatDateTime(rs("date"),vbShortDate)
yyq136 2005-01-26
  • 打赏
  • 举报
回复
response.write year(str_date)&"-"&month(str_date)&"-"&day(str_date)
nnyyang 2005-01-26
  • 打赏
  • 举报
回复
我用的是 ASP的javascript

28,409

社区成员

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

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