All right.
So we've made it through that war zone of string and numbered types in particular the number types are
always a bit hairy but we're moving on to something equally finicky dates and times.
Often the bane of many programmers existence having to deal with time zones and synchronizing things
across the world in the daylight savings it's just a nightmare Piers.
Fortunately my school makes it relatively simple for us.
I'm going to show you how in the next couple of videos this is going to be serious 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 will take a look at.
So the first one is called data and what it does is it just stores a date without a time.
So the format looks like this year year year year year dash month month dash date day.
So 1999 dash 11 dash twenty five or something.
So as it states here that that stores that 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 web sites 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 the 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 time.
Maybe if you're I don't know if you're working with reminders maybe like I'm at a loss really.
But basically store times and the syntax the format is our our dash or excuse me Colan 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 and 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 the date and
time.
And this is pretty useful and 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 to use or signed up for your site or when something
was last updated.
You know 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.
You know if I comment on someone's post Facebook doesn't just store the time that I commented.
Ten thirty nine P.M. 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 something you know I commented it will say like Colt commented three seconds ago 20 minutes ago
two days ago last month and it needs more than just a time to figure that out.
Right and needs the time and that day.
So daytime 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 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.
So very easy.
You know 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 your date time is coming and the format is also what
you probably expect year year year year dash month month dash date day which is the date part and then
a space hour hour Cohen minute minute Colan second second which is the time component.
OK 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.