How can I convert a number such as 1994 into a date in d3?

Hi all!

How can I convert a number such as 1994 into a date in d3? My aim is to convert an array of such numbers into an array of dates.

When I use the new Date(1994) constructor the problem is the constructor assumes

Thanks for your time

Jaime

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.124 Safari/537.36

Challenge: Visualize Data with a Scatterplot Graph

Link to the challenge:

I think we need this sentence/paragraph finished :slightly_smiling_face:

1 Like

Hi @DanCouper

Thanks for your response and sorry for the badly written post (woops!)

I found the answer to my problem in a different forum, I just needed this code:

`// Create new Date instance
var date = new Date()

// Add a day
date.setDate(date.getDate() + 1)`

1 Like

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.