ASP程序用now()取得系统时间的格式不正确

henyzhang 2007-04-20 04:40:59
最近重装了下系统,XP的,完了之后,用now()取系统是间的格式变掉了,比如说:2007-4-20 下午 03:49:10,变成这个样子了,导致很多程序都会出错,不知道这个是怎么回事,应该是操作系统的时间格式的问题,但是我不知道怎么调回来.

控制面板中那个区域和时间里面的自定义都调过了。
还是老样子。
...全文
284 4 打赏 收藏 转发到动态 举报
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
smallcrocodile 2007-04-23
  • 打赏
  • 举报
回复
太才了,时间格式设置问题
Challenger_Ican 2007-04-22
  • 打赏
  • 举报
回复
要想让程序不受运行平台的影响,格式化now()得到的数据是个一劳永逸之策!以后如果有系统时间格式的变化,We DO NOT care!

asp下格式化时间和日期的函数
'将一个一位的数字前面加零
function FillZero(str)
ttt=str
if len(str)=1 then
ttt="0" & str
end if
FillZero=ttt
end function

'转化日期,将 一位补上零 2003-1-2 --> 2003-01-02
function ConvertDate(tDate)
ttt=tDate
if isdate(tDate) then
ttt=year(tDate) & "-" & FillZero(month(tDate)) & "-" & FillZero(day(tDate))
end if
ConvertDate=ttt
end function

'输入一个日期时间串,转换成年四位,其他两位的新的日期时间串
function ConvertDateTime(tDateTime)
ttt=tDateTime
if isdate(tDateTime) then
ttt=year(tDateTime) & "-" & FillZero(month(tDateTime)) & "-" & FillZero(day(tDateTime)) & " " & FillZero(cstr(hour(tDateTime))) & ":" & FillZero(cstr(minute(tDateTime))) & ":" & FillZero(cstr(second(tDateTime)))
end if
ConvertDateTime=ttt
end function

另:参考 http://faq.ajax-master.com/doc/webapp/ruhezai-asp-ligeshihuadangqianshijian_MTY0NjY-/
huzs_82 2007-04-21
  • 打赏
  • 举报
回复
格式化now()得到的数据
或传递参数得到合适的格式.
ltzhh 2007-04-20
  • 打赏
  • 举报
回复
把时间改成24时几时法.

6,871

社区成员

发帖
与我相关
我的任务
社区描述
Windows 2016/2012/2008/2003/2000/NT
社区管理员
  • Windows Server社区
  • qishine
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

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