ylbtech-JavaScript-util: util.date.js

日期处理工具

1.A,JS-效果图返回顶部
 
1.B,JS-Source Code(源代码)返回顶部
1.B.1, m.yintai

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;
}

1.B.2,

1.C,JS-Relevent References(相关引用)返回顶部
作者:ylbtech
出处:http://ylbtech.cnblogs.com/
本文版权归作者和博客园共有,欢迎转载,但未经作者同意必须保留此段声明,且在文章页面明显位置给出原文连接,否则保留追究法律责任的权利。

util.date.js的更多相关文章

  1. util.string.js

    ylbtech-JavaScript-util: util.string.js 字符串处理工具 1.A,JS-效果图返回顶部   1.B,JS-Source Code(源代码)返回顶部 1.B.1, ...

  2. JSON parse error: Cannot deserialize value of type `java.util.Date` from String

    DateTimePicker + @DateTimeFormat("yyyy-MM-dd HH:mm:ss")日期格式转换异常 最近在做的一个项目使用的日期格式是yyyy-MM-d ...

  3. java基础--java.util.Date类型小结

    首先先来了解一下Date数据类型: . Date类型通常要和另一个 java.text.SimpleDateFormat类联合使用. 把long-->Date: public Date(long ...

  4. 如何将util.Date转化为sql.Date

    通过查看API可以很容易知道,util.Date类时sql.Date的父类,所以根据向上转型的原理可以很简单的知道时可行的,不用做转换都可以. 但是如果想要将util.Date转化为sql.Date, ...

  5. sql.date and util.Date

    注意: 1.用 bean 接受 数据库查询的结果 sql.date 会自动转换为 util.date 2.想数据库插入date 类型,必须是要 sql.date 一.字符串 转 util.date S ...

  6. 前台传参数时间类型不匹配:type 'java.lang.String' to required type 'java.util.Date' for property 'createDate'

    springMVC action接收参数: org.springframework.validation.BindException: org.springframework.validation.B ...

  7. java.util.Date与java.sql.Date

    我数据库里用到了日期类型.用java编程的时候同时import了java.util.*和java.sql.*,发现直接申明Date类型 Date dt; 会报错,查了一下才发现有java.util.D ...

  8. Cannot convert value of type [java.lang.String] to required type [java.util.Date] for property 'xxx': no matching editors or conversion strategy found

    今天在完成项目的时候遇到了下面的异常信息: 04-Aug-2014 15:49:27.894 SEVERE [http-apr-8080-exec-5] org.apache.catalina.cor ...

  9. java.util.Date和java.sql.Date的区别和相互转化

    java.util.Date是在除了SQL语句的情况下面使用的.java.sql.Date是针对SQL语句使用的,它只包含日期而没有时间部分它 们都有getTime方法返回毫秒数,自然就可以直接构建. ...

随机推荐

  1. SystemTap 用法

    SystemTap需要内核符号表: http://ddebs.ubuntu.com/pool/main/l/linux/ 基本语法: next对应C中的return,中途返回: 今晚遗留了两个问题: ...

  2. BZOJ 1876 [SDOI2009] SuperGcd | PY好题

    题面就是让你求两个超级大整数,求GCD 题解: 题目本意应该是出题人想考考高精度取膜 但是可以通过一种神奇的Stein算法来做 由J. Stein 1961年提出的Stein算法很好的解决了欧几里德算 ...

  3. jquery字数限制超出显示...,原有内容在title中显示

    为标签添加class = sliceFont:添加data-num属性为要显示的字数,截取后会在title中显示原有字符串: $('.sliceFont').each(function(index, ...

  4. Hibernate中多对多的annotation的写法(中间表可以有多个字段)

    2011-07-04 6:52 一般情况下,多对多的关联关系是需要中间表的: 情况一:如果中间表仅仅是做关联用的,它里面仅有2个外键做联合主键,则使用ManyToMany(不用写中间表的Model,只 ...

  5. 《c程序设计语言》-2.6~2.8

    #include <stdio.h> unsigned setbits(unsigned x, int p, int n, unsigned y) { return (x & (( ...

  6. poj1039 Pipe(计算几何叉积求交点)

    F - Pipe Time Limit:1000MS     Memory Limit:10000KB     64bit IO Format:%I64d & %I64u Submit Sta ...

  7. mysql [MariaDB] 开启外联

    1.查看mysql服务端口是否为外部端口,如果监听的是本地端口修改mariadb配置文件 root@kali:~# whereis mysql mysql: /usr/bin/mysql /etc/m ...

  8. 【MFC】画线

    1.DrawTestDlg.h afx_msg void OnLButtonDown(UINT nFlags, CPoint point); afx_msg void OnLButtonUp(UINT ...

  9. 更改了mysql的配置文件之后,启动不了mysql服务

    更改了mysql的配置文件之后,启动不了mysql服务 mysql数据库error: Found option without preceding group in config file 问题解决 ...

  10. xxx.service is not a native service, redirecting to /sbin/chkconfig.

    centos7编译安装的程序无法用systemctl 启动 [root@nagios-server check_commands]# systemctl enable npcd.service npc ...