这个目的是记下来,好让我以后可以看一下,这个脚本可是反反复复写了我N天啊!!

全部写下,以备后用!

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;
} /**
* ajax刷新竞价数据
*
* @param code
* @return
*/
function QuoteList(code) {
$.ajax({
type : 'POST',
url : appServer + "/tradingCenter/rntrustAllList.htm",
dataType : "json",
data : {code : code},
// data : "projectCode=" + code + "&reason=" + reason,
async : false,
success : function(msg) {
// var resultCollection = jQuery.parseJSON(msg.d);
var htmlhead = '<div class="bd"><div class="listBox"><div> <table style="width:100%;"><tr style="height:20px;"><th>委托号名</th><th>委托价格(元/吨)</th><th>委托数量(吨)</th><th>委托时间</th><th>委托状态</th></tr>';
var content_html="";
var content_htmltemp = "";
var htmlfoot = "</table></div></div></div>"; var entrustPrice = '0.0';
var entrustAmount = '0.000'; var resultInfo = $("#resultInfo");
$.each(msg, function (index, item) { var Datetemp= new Date(item.gmtEntrust);// 这里必须是整数,毫秒
var dateStr = Datetemp.format("yyyy-MM-dd hh:mm:ss");
// alert(dateStr);
content_htmltemp = "<tr>"
+ "<td align='center'>" + item.entrustNo + "</td>"
+ "<td align='center'>" + item.entrustPriceDes + "</td>"
+ "<td align='center'>" + item.entrustAmountDes + "</td>"
+ "<td align='center'> " + dateStr + "</td>"
+ "<td align='center'>" + item.entrustStatusDes + "</td>"
+ "</tr>";
content_html = content_html + content_htmltemp;
entrustAmount = (parseFloat(entrustAmount) + parseFloat(item.entrustAmountDes)); if (parseFloat(item.entrustPriceDes) > parseFloat(entrustPrice)){
entrustPrice = item.entrustPriceDes;
} });
resultInfo.html(htmlhead + content_html + htmlfoot); //价格和数量
if(entrustPrice == '0.0'){
$("#entrustPrice").text("无人报价");
$("#entrustAmount").text("0");
}else{
$("#entrustPrice").text(entrustPrice);
$("#entrustAmount").text(entrustAmount);
}
},
error : function() {
// alert("服务器忙,请稍后重试");
}
});
}

javascript 把时间戳转为时间 ajax HTML拼装的更多相关文章

  1. js实现UTC时间转为北京时间,时间戳转为时间

    用了阿里云的接口,发现其穿的日期是UTC格式的.需要转换. var utc_datetime = "2017-03-31T08:02:06Z"; function utc2beij ...

  2. Excel中如何将时间戳转为时间?

    Unix时间戳转换Excel时间? Excel中如何将时间戳转为时间? Excel默认不支持Unix格式时间戳,这在导入数据时十分不便.可以用以下公式将时间戳转换成Excel格式的时间: =(x+8* ...

  3. js将时间戳转为时间格式

    时间戳转时间格式 //分钟 let timeM= parseInt(msg/1000/60%60); if(timeM<10){ timeM="0"+timeM; } //秒 ...

  4. JavaScript中时间戳和时间的相互转换

    时间转换成时间戳: var time = new Date(); var timestamp=Date.parse(time)   //毫秒数,得到秒除以1000: 时间戳转成时间: 1.转换成 20 ...

  5. UTC时间戳转为时间

    /// <summary> /// 将UTC时间转化DateTime时间 /// </summary> /// <returns></returns> ...

  6. java 时间戳转为时间

    Date date = new Date(Long.parseLong(String.valueOf("1560235259477")));SimpleDateFormat for ...

  7. 10位时间戳转为C#格式时间

    /// <summary> /// 10位时间戳转为C#格式时间 /// </summary> /// <param name=”timeStamp”></p ...

  8. 时间戳转为C#格式时间

    经常发现很多地方使用一个时间戳表示时间.比如: 1370838759 表示 2013年6月10日 12:32:39. 我们就需要一个工具,方便地转换这种时间格式 什么是时间戳? 时间戳, 又叫Unix ...

  9. C#关于时间(获取特定格式的时间及多种方式获取当前时间戳)以及10位和13位时间戳转为特定格式

    C#关于时间(获取特定格式的时间及多种方式获取当前时间戳)以及10位和13位时间戳转为特定格式 置顶 2018年03月06日 19:16:51 黎筱曦 阅读数:19098 标签: C#时间 更多 个人 ...

随机推荐

  1. h5 网页版的微博微信QQ登录

    一:微博 1,先说微博吧,首先你的去http://open.weibo.com/wiki/先注册账号,通过验证审核.然后的创建网页应用.微博审核不通过的原因就是域名和网站地址,一定要按实际写的.一定要 ...

  2. 原生js移动端列表无缝间歇向上滚动

    在项目开发中尤其是在项目的活动页面的开发中,经常需要将用户的购买信息或中奖信息等以列表的形式展示在页面当中,并可以使其自动间歇向上滚动来达到在有限的区域内展示所有信息的目的.通常的做法是通过将列表父元 ...

  3. angularjs+ionic的app端分页和条件

    做app项目积分商城的商品列表需要分页显示 实现: ionic滚动条:ion-scroll 用于创建一个可滚动的容器. 附:菜鸟教程:http://www.runoob.com/ionic/ionic ...

  4. web性能优化之--合理使用http缓存和localStorage做资源缓存

    一.前言 开始先扯点别的: 估计很多前端er的同学应该遇到过:在旧项目中添加新的功能模块.或者修改一些静态文件时候,当代码部署到线上之后,需求方验收OK,此时你送了一口气,当你准备开始得意于自己的ma ...

  5. 动态SQL中不同变量的写法总结

    .一般变量的写法: if (str_kind is not null) then l_str_kind := str_kind; v_wheresql := v_wheresql || ' and k ...

  6. 用js来实现那些数据结构13(树01-二叉搜索树的实现)

    前一篇文章我们学会了第一个非顺序数据结构hashMap,那么这一篇我们来学学树,包括树的概念和一些相关的术语以及二叉搜索树的实现.唉?为什么不是树的实现,不是二叉树的实现.偏偏是二叉搜索树的实现?嗯, ...

  7. Nginx之(二)Nginx安装

    首先从官网上http://nginx.org/下载最新的stable version源码,当前最新版本为nginx-1.10.2.tar.gz. 2.1 configure 解压之后,会发现里面有一个 ...

  8. pandas小记:pandas高级功能

    http://blog.csdn.net/pipisorry/article/details/53486777 pandas高级功能:面板数据.字符串方法.分类.可视化. 面板数据 {pandas数据 ...

  9. 让你的代码量减少3倍!使用kotlin开发Android(三) 缩短五倍的Java Bean

    回顾一下 哈,没想到你已经坚持不懈看到第三篇了,不错哈~坚持就是胜利. 本文同步自博主的私人博客wing的地方酒馆 在上一篇文章中,我们介绍了扩展函数,这里对上一篇进行一点小小的补充. 还记得text ...

  10. Oracle EBS各个模块日志收集的方法

    MSCA(Mobile Supply Chain Application)日志的收集 Reference Note:338291.1 - Howto Enable WMS / MSCA Logging ...