Platform
Resources
Pricing
Sign in
Get started
Clinton Brownley
Data Scientist, Author, DataVis, Educator, Speaker, Public Service @ClintonBrownley https://cbrownley.github.io
Workspace
Fork
Public
By
Clinton Brownley
Edited
Feb 16, 2021
1
Insert cell
Insert cell
// "Mon Sep 07 14:36:32 +0000 2020"
tweets
.
map
(
d
=>
(
{
id
:
d
.
id
,
created_at
:
moment
.
utc
(
d
.
created_at
,
"ddd MMM DD HH:mm:ss +SSSS YYYY"
)
.
format
(
"MM/DD/YYYY HH:mm:ss"
)
}
)
)
.
slice
(
0
,
5
)
Insert cell
moment
=
require
(
"moment"
)
Insert cell
tweets
.
map
(
d
=>
(
{
id
:
d
.
id
,
created_at
:
d3
.
timeHour
.
offset
(
utcParser
(
d
.
created_at
)
,
7
)
}
)
)
.
slice
(
0
,
5
)
Insert cell
utcParser
=
d3
.
utcParse
(
"%a %b %0d %H:%M:%S %Z %Y"
)
Insert cell
tweets
.
map
(
d
=>
(
{
id
:
d
.
id
,
created_at
:
localeFormatter
(
d3
.
timeHour
.
offset
(
localeParser
(
d
.
created_at
)
,
7
)
)
}
)
)
.
slice
(
0
,
5
)
Insert cell
localeFormatter
=
d3
.
timeFormat
(
'%Y-%m-%d %H:%M:%S'
)
Insert cell
localeParser
=
d3
.
timeParse
(
"%a %b %0d %H:%M:%S %Z %Y"
)
Insert cell
tweets
.
map
(
d
=>
(
{
id
:
d
.
id
,
created_at
:
new
Date
(
d
.
created_at
)
,
hour
:
new
Date
(
d
.
created_at
)
.
getHours
(
)
}
)
)
.
slice
(
0
,
5
)
Insert cell
tweets
=
FileAttachment
(
'tweets_condensed.json'
)
.
json
(
)
Insert cell
Insert cell
Insert cell
Purpose-built for displays of data
Observable is your go-to platform for exploring data and creating expressive data visualizations. Use reactive JavaScript notebooks for prototyping and a collaborative canvas for visual data exploration and dashboard creation.
Try it for free
Learn more
Fork
View
Export
Edit
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
moment
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
utcParser
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
localeFormatter
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
localeParser
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
tweets
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
locale
Edit
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
d3
Edit
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML