您的位置:程序门 -> web 开发 -> asp



asp中什么实现yyyymmdd时间格式


[收藏此页] [打印本页]选择字色:背景色:字体:[][][]


asp中什么实现yyyymmdd时间格式
发表于:2008-01-22 17:36:04 楼主
比如把2008-1-22变成20080122这种格式.
发表于:2008-01-22 17:41:151楼 得分:0
format(your   string,'yyyymmdd')
发表于:2008-01-22 17:48:092楼 得分:0
d=date()
str=year(d)&month(d)&day(d)
发表于:2008-01-22 17:49:423楼 得分:0
d=cdate("2008-1-10")
str=year(d)&month(d)&day(d)
------------------------
d="2008-1-10"
str=replace(d,"-","")
...............
好像,方法还是比较多的
发表于:2008-01-22 17:51:484楼 得分:0
<script   type="text/javascript">
date.prototype.format   =   function(format)
{
        var   o   =
        {
                "m+"   :   this.getmonth()+1,   //month
                "d+"   :   this.getdate(),         //day
                "h+"   :   this.gethours(),       //hour
                "m+"   :   this.getminutes(),   //minute
                "s+"   :   this.getseconds(),   //second
                "q+"   :   math.floor((this.getmonth()+3)/3),     //quarter
                "s"   :   this.getmilliseconds()   //millisecond
        }
        if(/(y+)/.test(format))
        format=format.replace(regexp.$1,(this.getfullyear()+"").substr(4   -   regexp.$1.length));
        for(var   k   in   o)
        if(new   regexp("("+   k   +")").test(format))
        format   =   format.replace(regexp.$1,regexp.$1.length==1   ?   o[k]   :   ("00"+   o[k]).substr((""+   o[k]).length));
        return   format;
}

var   ddd   =   new   date();
document.write   (ddd.format('yyyymmdd'));
</script>
来自互连网



快速检索

最新资讯
热门点击