参考的博文:http://blog.csdn.net/zhu7478848/article/details/53388582 在IE浏览器下, JavaScript字符串转换成Date后会出现NaN错误,但是在其他的浏览器下,都没有问题. 因此,转变字符串的格式. var date = new Date("2016-10-11") 在IE下date是NaN,而其他浏览器正常. 字符串修改成 2016/10/11 var date = new Date("2016-10
方法一: var t = "2015-03-16";var array = t.split("-");var dt = new Date(array[0], array[1], array[2]);// var dtt = new Date(t.replace("-g-/", "")); 方法二: var remindTime = "2008-04-02 10:08:44"; var str =
//字符串转成Time(dateDiff)所需方法 function stringToTime(string) { var f = string.split(' ', 2); var d = (f[0] ? f[0] : '').split('-', 3); var t = (f[1] ? f[1] : '').split(':', 3); return (new Date( parseInt(d[0], 10) || null, (parseInt(d[1], 10) || 1) - 1, p
SimpleDateFormat format = new SimpleDateFormat( "yyyy-MM-dd HH:mm:ss" ); String date = format.format(new Date(Long.parseLong("1442246400000"))); System.out.println("Format To String(Date):"+date);
function GetDateByShiJianChuo(timespan) { var date = new Date(parseInt(timespan.replace("/Date(", "").replace(")/", ""))); var dateStr = date.toLocaleDateString(); dateStr = dateStr.replace("/", "-&qu