C# Js 时间格式化问题
C# 后台:
.ToString("dd-MMM-yyyy", System.Globalization. DateTimeFormatInfo.InvariantInfo) eg : 29-Aug-2013
Js 前台:
monName = new Array( "Jan", "Feb" , "Mar", "Apr", "May" , "Jun", "Jul", "Aug" , "Sept", "Oct", "Nov" , "Dec") Date.prototype.format = function (format) {
if (!format) {
format = "yyyy-MM-dd hh:mm:ss";
} if (/(y+)/.test(format)) {
format = format.replace(RegExp.$1, ( this.getFullYear() + "" ).substr(4 - RegExp.$1.length));
}
if (/(M+)/.test(format)) {
format = format.replace(RegExp.$1, (monName[ this.getMonth()] + "" ).substr(3 - RegExp.$1.length));
}
if (/(d+)/.test(format)) {
format = format.replace(RegExp.$1, ( "00" + this .getDate() + "").substr(( "" + this .getDate()).length));
}
return format;
}; function formatJsonDate(str) { if (str != null &&str!='') {
return (new Date(parseInt(str.substring(str.indexOf( '(') + 1, str.indexOf(')' ))))).format("dd-MMM-yyyy");
}
else {
return '' ;
}
世上本无垃圾,所谓垃圾是你放错了地方
C# Js 时间格式化问题的更多相关文章
- js 时间格式化 (兼容safari)
js 时间格式化,兼容IE8和safari浏览器. function formatDate(date, fmt, near, type) { var dateStr = date; if (!date ...
- js时间格式化函数,支持Unix时间戳
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/ ...
- 时间戳显示为多少分钟前,多少天前的JS处理,JS时间格式化,时间戳的转换
var dateDiff = function (timestamp) { // 补全为13位 var arrTimestamp = (timestamp + '').split(''); for ( ...
- 表单序列化json字符串和js时间格式化
js时间格式化 new Date().format("时间格式") Date.prototype.format = function(fmt) { var o = { ...
- js时间格式化
const formatDate = timestamp => { const date = new Date(timestamp); const m = date.getMonth() + 1 ...
- js时间格式化(yy年MM月dd日 hh:mm)
//时间格式化 Date.prototype.format = function (format) { var o = { "M+": this.getMonth() + 1, / ...
- js 时间格式化 -- 时间加减实现
时间格式化的方法: Date.prototype.Format = function (fmt) { //author: meizz var o = { "M+": this.ge ...
- JS 时间格式化函数
//时间格式化函数 Date.prototype.format = function (format) { var o = { "M+": this.getMonth() + 1, ...
- js时间格式化函数(兼容IOS)
* 时间格式化 * @param {Object} dateObj 时间对象 * @param {String} fmt 格式化字符串 */ dateFormat(dateObj, fmt) { le ...
- moment.js时间格式化库
网址:momentjs.cn 主要用来操作时间的格式化.通过发送API请求获取到的数据中:例如[新闻]中的 发布时间,有的时候.请求到的时间,后台没处理过,那么只能前端来操作数据了. moment.j ...
随机推荐
- PAT乙级1032
1032 挖掘机技术哪家强 (20 分) 为了用事实说明挖掘机技术到底哪家强,PAT 组织了一场挖掘机技能大赛.现请你根据比赛结果统计出技术最强的那个学校. 输入格式: 输入在第 1 行给出不超过 ...
- python 位置参数和关键字参数 *args **kwargs
#!/usr/bin/env pythondef foo(*args,**kwargs): print('args: {0}'.format(args)) print('kwargs {0}'.for ...
- (转)CentOS 7 —— /etc/rc.local 开机不执行 - 解决方法
chmod +x /etc/rc.d/rc.localsystemctl enable rc-local.service Note: rc.local is obsolete. ----------- ...
- C++内存管理变革(6):通用型垃圾回收器 - ScopeAlloc
本文已经迁移到:http://cpp.winxgui.com/cn:a-general-gc-allocator-scopealloc C++内存管理变革(6):通用型垃圾回收器 - ScopeAll ...
- Hadoop应用开发,常见错误
错误1:在windows执行mr Exception in thread "main" java.lang.UnsatisfiedLinkError: org.apache.had ...
- Linux服务-samba
目录 1. samba简介 2. samba访问 Linux服务-samba 1. samba简介 Samba是在Linux和UNIX系统上实现SMB协议的一个免费软件,由服务器及客户端程序构成. 在 ...
- Redis持久化存储详解(一)
> 为什么要做持久化存储? 持久化存储是将 Redis 存储在内存中的数据存储在硬盘中,实现数据的永久保存.我们都知道 Redis 是一个基于内存的 nosql 数据库,内存存储很容易造成数据的 ...
- STM32单片机复位后GPIO电平状态
stm32单片机gpio共有八种工作模式,如下图: stm32单片机是一个低功耗的处理器,当复位以后,gpio默认是高阻状态,也就是浮空输入.这样的好处是: 1.降低了单片机的功耗 2.把gpio模式 ...
- python基础学习1-类相关内置函数
#!/usr/bin/env python # -*- coding:utf-8 -*- #===issubclass(class,classinfo) 检查class是否是classinfo类的子类 ...
- 公历转农历的python实现
大杂烩.作为自己的记录,保存. 两个要点: 1.公历转农历用了查表法(第126行) 2.节气用了天文法?(第176行) 运行图 (背景是hao123万年历) 源代码: # lunar.py # 20 ...