如何在jquery或javascript中格式化日期? [英] How do I format dates in jquery or javascript?

查看:69
本文介绍了如何在jquery或javascript中格式化日期?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好,



我有一个以下函数,它接受类型为date的参数。参数,即reptdate的格式为2013年12月23日00:00:00,另一个与其比较的变量值为12/23/2013​​形式。如何转换参数值以匹配表达式中的值?我希望转换参数值,因为它在许多其他函数中被调用。请帮忙。





Hello,

I have a following function which takes a parameter of type date. The parameter i.e., reptdate is in this format Mon Dec 23 00:00:00 EST 2013 and another variable with which it compares value is in "12/23/2013" form. How to convert the parameter value to match the one in expression? I want to convert parameter value instead as it is called in many other functions. Please help.


function checkrecord(reptdate) {

 if (reportdate != '' ){

$('#tblearn tr[id]').each(function () {
      var _v_reptdate = $.trim($(this).find('[colname = "daterpted"]').html());
      if (reptdate == _v_reptdate)  {
            alert('do something');
                    }

                })
            }
        }





换句话说,我想将reptdate 转换为12月23日00:00:00 EST 2013格式到_v_reptdate,即12/2 3/2013format



In other word I want to convert reptdate which is in Mon Dec 23 00:00:00 EST 2013 format to _v_reptdate which is in "12/23/2013" format

推荐答案

' #tblearn tr [id]')。each(function(){
var _v_reptdate =
('#tblearn tr[id]').each(function () { var _v_reptdate =


。 trim(


this )。find(' [colname =daterpted]')。html());
if (reptdate == _v_reptdate){
alert(' 做某事');
}

})
}
}
(this).find('[colname = "daterpted"]').html()); if (reptdate == _v_reptdate) { alert('do something'); } }) } }





其他我希望将reptdate 转换为_ 12月23日00:00:00 EST 2013格式为_v_reptdate,其格式为12/23/2013​​格式



In other word I want to convert reptdate which is in Mon Dec 23 00:00:00 EST 2013 format to _v_reptdate which is in "12/23/2013" format


这篇关于如何在jquery或javascript中格式化日期?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆