● videoExtraction
Tangent: Working with Dates

Unlock PostgreSQL Fundamentals
2 hours of SQL video using NASA's Cassini data. See why developers become data pros.
SECTION
Extraction
NEXT UP
Validating the Master Plan
COURSE
PostgreSQL Fundamentals
28 lessons
About this lesson
Bottom line: never trust a spreadsheet. You're going to hear me say that a lot in this production! Especially when it comes to dates.
Postgres is pretty good at dealing with dates... in fact it's amazingly powerful as well as correct:
select now(); -- what date and time is it where my server is located?
select now() + '1 day' as tomorrow; -- adding an interval is extremely easy
select now() at time zone 'America/New_York'; -- specifying a timezone
If you're reading this in a browser, which I assume you are, open up the developer tools using CMD-shift-i (or Ctrl-shift-i on Windows) and open the console.
To see a typical date for JavaScript (and many other languages):
new Date() //prints out a long-form date
To see an ISO date, which most databases like, you can use:
new Date().toISOString();
This is a format you should let your eyes get used to.
Unlock PostgreSQL Fundamentals
2 hours of SQL video using NASA's Cassini data. See why developers become data pros.