All right.
So we've made it through that war zone of string and number types in particular.
The number types are always a bit hairy, but we're moving on to something equally finicky.
Dates and times are often the bane of many programmers existence, having to deal with time zones and
synchronizing things across the world and daylight savings.
It's just a nightmare leap year.
Fortunately, my SQL makes it relatively simple for us.
I'm going to show you how in just next couple of videos.
So this is going to be a series here, not just a single video.
And in fact, in this first video, I'm just going to give you a quick overview of the three important
data types that we'll take a look at.
So the first one is called date.
And what it does is it just stores a date without a time.
So the format looks like this.
Yea yea yea yea yea.
Dash month month dash de day.
So 1999, dash 11, dash 25 or something.
So as it states here that that store is a date but no time.
So there are instances where you may use this, things like a birthday.
If you're asking a user to sign up and specify their birthday, most users don't know the time.
Well, I don't know.
I don't know the time I was born.
I know a lot of people do, but it doesn't matter, at least for most websites.
It doesn't matter what time someone was born.
You just need that date.
Another option is the opposite the time.
So time is another data type that stores values with a time but no date.
So out of the three, I'm going to show you, this is the one I use the least by far, because there's
not many things that you just need to store a time.
Maybe if you're I don't know if you're working with reminders, maybe like or working, I'm at a loss
really.
But basically store times and the syntax, the format is our our dash or excuse me, colon, minute,
minute, colon second, second.
And the final data type and the one that I use by far the most out of all of them is date time.
Not very creative.
I know it.
Just date.
Plus time does what it sounds like, which I also realize I'm saying way too often in this course,
but it stores values with a date and a time and this is pretty useful.
You get both.
And like I said, this is what I use the most.
So when you're doing things like I don't know when a user signed up for your site or when something
was last updated, when a profile picture was last updated, or when somebody commented on a Facebook
post.
Those are all stored with date times because just having the time on its own isn't that useful.
So let's go with this Facebook example.
If I comment on someone's post, Facebook doesn't just store the time that I commented 10:39 p.m.,
let's say, because it's just not that useful to them.
You know, I think what Facebook does is it displays things like how many days ago or hours or minutes
ago or something.
I commented, It will say like Colt commented 3 seconds ago, 20 minutes ago, two days ago, last month,
and it needs more than just a time to figure that out.
Right.
I need to time end the day.
So date time, very, very useful and used all the time in applications.
And a really common use case in programming in general is when you have a column or let's say a row
in a database and a table and it's created, you often want to just store the date and time it was created
so that you can then go and sort things based off of how new they are and how old they are.
It's very easy if you're working on comments, for example, going back to Facebook.
Facebook comments are displayed in the order that they were written and posted.
So you need to store that created at time so that to our date times come in and the format is also what
you probably expect your year, year, year, dash, month, month dash de day, which is the date part
and then a space.
Our our colon.
Minute, minute, colon, second, second, which is the time component.
So we talked about those three.
We didn't see them in action, but we saw that they exist.
Date and time and date, time and again.
I use date time the most.
We'll be using it the most.
It's the most versatile and the most useful.