<script>Date.prototype.format = function (fmt) { //author: meizzvar o = {"M+": this.getMonth() + 1, //月份"d+": this.getDate(), //日"h+": this.getHours(), //小时"m+": this.getMinutes(), //分"s+": this.getSeconds(), //秒"q+": Math.floor((this.getMonth() + 3) / 3), //季度"S": this.getMilliseconds() //毫秒};if (/(y+)/.test(fmt)) fmt = fmt.replace(RegExp.$1, (this.getFullYear() + "").substr(4 - RegExp.$1.length));for (var k in o)if (new RegExp("(" + k + ")").test(fmt)) fmt = fmt.replace(RegExp.$1, (RegExp.$1.length == 1) ? (o[k]) : (("00" + o[k]).substr(("" + o[k]).length)));return fmt;}var timel =new Date().format("yyyy-MM-dd HH:mm:ss");alert(timel)
</script>
详细解决方案
写一个方法对日期格式化 new Date().format(yyyy-MM-dd HH:mm:ss)
热度:79 发布时间:2024-01-20 08:43:03.0
相关解决方案
- Date 的转化,该如何解决
- 诸位大神,js 中的Date.parse(new Date()) 在 java中 得到的值为什么不一样呢
- f.format 简单有关问题
- 请教将string 中的yyyy-MM-dd 转换成日期类型dd-MM-yyyy 要如何做
- Print date,该如何处理
- @Model.CurrentArticle.PubDate.ToString("yyyy-MM-dd HH:mm")解决方案
- 从后台老板接收的时间数据,转换成Json后变成了"/Date(1350144054950+0800)/"
- js new Date().getTime()出有关问题了
- <input type="date" runat="server">为什么会出错呢?该怎么解决
- 等价语句jointime.ToString("yyyy-MM-dd H:mm:ss")解决方案
- format() 怎么格式化字符窜的长度
- DateTime.Now.ToString("yyyy/MM/dd tt hh:mm:ss")插入sql數據庫日期字段出錯?该怎么处理
- DDN String.Format 中能转义 { & } 吗?接分啊兄弟们^该怎么处理
- 2007-04-26 10:56:35.340 如果转换成mm/dd/yyyy hh:mm:ss解决思路
- <%# string.Format("{0} " Eval("Name")) %> 与 <%# Eval("Name") %> 有什么区别?该如何处理
- Input string was not in a correct format. 这个异常,是什么有关问题啊
- 请问:怎么在excel表格中设置单元格式为年(yyyy)或年月(yyyy/mm)或年月日(yyyy/mm/dd)
- 关于vxworks TFFS文件系统搭建时 format 死机有关问题
- format(now,"yyyy-mm-dd hh:mm:ss")的疑问解决方法
- assume cs:code,ds:date,ss:strack,该如何解决
- 为啥这个查询语句不行min(date)
- informix 数据库 sqlexception -1204Invalid year in date,该怎么处理
- svn同步异常Transaction is out of date
- 用Windows Media Format 9.5 SDK开发,写入H264流的有关问题
- java.util.Date 问题
- Response.Cookies("Member").Expires=Date + 30,请问30的单位是什么? ...
- 怎样从MySQL里面取出日期转换成 yyyy-MM-dd HH:mm:ss格式!该如何处理
- <%=month(Date())%>如果是sql数据库应该如何写
- 关于在asp中调用microsoft date and time picker组件显示日期的有关问题
- 'date' 不是可以识别的 函数名,该如何处理