Forum Discussion
MaddieSchroe307
2 years agoCommunity Member
Using Javascript for X Days Ago in MM/DD/YYYY Format
Hello,
I would very much appreciate some help here. I need to have the learner open up this learning and have the current date displayed, as well as some dates prior to it (-10 days, -15 days, -2...
MaddieSchroe307
2 years agoCommunity Member
Hi Royston,
I would say it is for sure possible. I don't know the exact answer since I came to this through a bit of trial and error. You could look at the following below and see if swapping it out at the right place gives you the format you are looking for
toString()
gives you Fri Jul 02 2021 14:03:54 GMT+0100 (British Summer Time)toDateString()
gives you Fri Jul 02 2021toLocaleString()
gives you 7/2/2021, 2:05:07 PMtoLocaleDateString()
gives you 7/2/2021toGMTString()
gives you Fri, 02 Jul 2021 13:06:02 GMTtoUTCString()
gives you Fri, 02 Jul 2021 13:06:28 GMTtoISOString()
gives you 2021-07-02T13:06:53.422Z