我有一個日期字符串「2012-11-14T06:57:36 + 0000」,我要轉換爲以下格式「2012年11月14日12:27」。我嘗試了很多解決方案,包括Convert UTC Date to datetime string Javascript。但沒有什麼可以幫助我。以下代碼在android中適用於我。但對於IOS它顯示爲無效日期轉換UTC日期時間字符串鈦
var date = "2012-11-14T06:57:36+0000";
//Calling the function
date = FormatDate(date);
//Function to format the date
function FormatDate(date)
{
var newDate = new Date(date);
newDate = newDate.toString("MMMM");
return (newDate.substring(4,21));
}
誰能幫助我?在此先感謝
感謝Mejo,它爲我工作 – Anand