Tag: 时候,

格式date与moment.js

我有这种格式的string: var testDate = Fri Apr 12 2013 19:08:55 GMT-0500 (CDT) 我想用这个格式的mm/dd/yyyy : 04/12/2013来显示。 我试图用这个方法来做, moment(testDate,'mm/dd/yyyy'); 哪个错误说there is no such method called replace ? 我以错误的方式接近这个吗? 编辑: 我还应该提到,我正在使用pre.js包装版本的meteor.js Object [object Date] has no method 'replace' : The Exact error from the console 堆栈跟踪: at makeDateFromStringAndFormat (http://127.0.0.1:3000/packages/moment/lib/moment/moment.js?b4e3ac4a3d0794023a4410e7941c3e179398b5b0:539:29) at moment (http://127.0.0.1:3000/packages/moment/lib/moment/moment.js?b4e3ac4a3d0794023a4410e7941c3e179398b5b0:652:24) at populateProfileForEdit (http://127.0.0.1:3000/client/views/home/administration/directory/profiles/profiles.js?acfff908a6a099f37312f62892a22b40f82e5e0f:147:25) at Object.Template.profile_personal.rendered (http://127.0.0.1:3000/client/views/home/administration/directory/profiles/profiles.js?acfff908a6a099f37312f62892a22b40f82e5e0f:130:13) at […]