- All right, so it's time to start working with the dates.…I want to get the chart to load…the last 30 days of data by default,…and then feed that into our chart generator.…I'll start by creating a couple of variables…at the very top of our script.…One is going to hold the "from" date, or the beginning date,…and the other one will hold the "to" date,…or the ending date.…Now I'm gonna scroll all the way down…to the bottom of my script,…right after all my functions,…and do the rest of the set-up.…So here, we're going to set up the fromDate variable,…and we'll start by generating a new date…by using the new Date() method here.…
Then, we're gonna modify that date,…because the new Date()…is just gonna give us the current date.…So we need to modify that by using the setDate function,…and we take the original fromDate,…and we generate a new date with the getDate function,…and then subtract 31 from that.…That's gonna give us a date 31 days ago.…The toDate will be pretty much the same as this,…except that we're gonna ask for just one day ago.…
Visit other courses in the series to see how to solve the exact same challenges in languages like C++, C#, Java, PHP, Python, R, Ruby, and Swift.
Skill Level Intermediate
1. Problem One - Exploring Lake Pend Oreille
2. Problem Two: Image Analysis
3. Problem Three: Eight Queens
4. Problem Four: Accessing Peripherals
5. Problem 5 - Recursion and Directories
6. Problem 6 - Building the Web
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
This will not affect your course history, your reports, or your certificates of completion for this course.Cancel
Take notes with your new membership!
Type in the entry box, then click Enter to save your note.
1:30Press on any video thumbnail to jump immediately to the timecode shown.
Notes are saved with you account but can also be exported as plain text, MS Word, PDF, Google Doc, or Evernote.