Angular開發學習筆記:字符串與時間類型的轉換

1.字符串時間格式的互轉

SubmitData(data: any) {
    // let AccountDate = new Date(data.AccountDate);
    let AccountDate = new Date('2019/11/26');
    console.log('當前AccountDate數據:', AccountDate);
    console.log('當前AccountDate數據:', AccountDate.toLocaleDateString());
    data.AccountDate = AccountDate.toLocaleDateString();
    console.log('當前表單提交數據:', data);
  }

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章