Discuss Scratch

PoIygon
Scratcher
1000+ posts

How do you convert scratch’s time thing in the api to real time?

When I’m making a request in the api there’s this time thing that is really confusing and I wanna convert it so it doesn’t look janky










CST1229
Scratcher
1000+ posts

How do you convert scratch’s time thing in the api to real time?

Assuming you're using JavaScript, you can get the date in UTC easily:
const date = "2007-03-05T10:47:41.000Z".split("T")[0];
// 2007-03-05
You can also get the time:
const time = "2007-03-05T10:47:41.000Z".split("T")[1].replace(".000Z", "");
// 10:47:41

Last edited by CST1229 (Sept. 13, 2021 09:29:59)


This is a signature. It's a piece of text that appears below every post I write. Click here to learn more, including how to make your own.
RIP assets image hosting. 2013?-2023



Powered by DjangoBB