Published unlisted
Edited
Apr 22, 2020
Insert cell
Insert cell
Insert cell
date = new Date('2020-04-22T00:00:00Z')
Insert cell
Insert cell
date.toISOString() // Everyone should see "2020-04-22T00:00:00.000Z"
Insert cell
date.toLocaleString() // I see "4/21/2020, 5:00:00 PM"
Insert cell
date.toString() // I see "Tue Apr 21 2020 17:00:00 GMT-0700 (Pacific Daylight Time)"
Insert cell
Insert cell
d3 = require('d3-time-format@2')
Insert cell
Insert cell
format = d3.timeFormat('%Y-%m-%d %H:%M')
Insert cell
format(date) // I see "2020-04-21 17:00"
Insert cell
Insert cell
utcFormat = d3.utcFormat('%Y-%m-%d %H:%M')
Insert cell
utcFormat(date) // Everyone should see "2020-04-22 00:00"
Insert cell

One platform to build and deploy the best data apps

Experiment and prototype by building visualizations in live JavaScript notebooks. Collaborate with your team and decide which concepts to build out.
Use Observable Framework to build data apps locally. Use data loaders to build in any language or library, including Python, SQL, and R.
Seamlessly deploy to Observable. Test before you ship, use automatic deploy-on-commit, and ensure your projects are always up-to-date.
Learn more