RSS フィードの日付を月/日/年 (2012 年 8 月 3 日) にフォーマットしようとしています。私は次のコードでそれをやっています:
// pubDate
postDate = new Date("Fri Aug 03 2012 06:08:11 GMT-0700");
// reformat pubDate
pubDate = postDate.getMonth() + "/" + postDate.getDate() + "/" + postDate.getFullYear();
// return pubDate
console.log(pubDate + " pubDate");
私の現在のコードでは、出力は 7/3/2012 ですが、月が正しくありません。8 ではなく 7 を取得します。正しい月を生成するにはどうすればよいですか?