经典ASP - 格式化日期 [英] Classic ASP - format date

查看:114
本文介绍了经典ASP - 格式化日期的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有个约会从哪个格式如下数据库被提取

I have a date being extracted from the database which is formatted as following

12/23/2005

这是

mm/dd/yyyy

我想它转换成传统的ASP以下

I want to convert it in classic asp to the following

December 23 2004

谁能帮我这个?

干杯,

推荐答案

您可以试试这个:

Function FormatDate(input)
    FormatDate = MonthName(Month(CDate(input))) & " " & Day(CDate(input)) & " " & Year(CDate(input))
End Function
Response.Write(FormatDate("12/23/2005"))

我假设你想让它显示2005年12月23日:如果你想让它显示2004年12月23日然后就减一年度()调用:

I'm assuming you want it to show "December 23 2005" if you want it to show "December 23 2004" then just subtract one from the Year() call:

FormatDate = MonthName(Month(CDate(input))) & " " & Day(CDate(input)) & " " & (Year(CDate(input))-1)

这篇关于经典ASP - 格式化日期的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆