【发布时间】:2018-07-15 04:52:28
【问题描述】:
好吧,假设我有一个每天都在变化的字符串,其中包含日期
var receiveddate = "Received on Saturday 14th of July 2018"
如何从中提取日期到示例formatreceiveddate = "2018-07-14"
我知道另一种方法是使用字符串插值和模板文字,但不知道如何反转它
所以我真正要问的是如何改变这个
Received on Saturday 14th of July 2018
Received on Saturday 5th of May 2018
Received on Monday 8th of January 2018
Received on Wednesday 19th of July 2017
Received on Sunday 1st of July 2018
Received on Tuesday 3rd of July 2018
Received on Saturday 2nd of June 2018
Received on Thursday 21st of June 2018
Received on Thursday 31st of May 2018
每个日期进入这个2018-07-14。
【问题讨论】:
标签: javascript date