WEBVTT

00:00.150 --> 00:00.720
All right.

00:00.720 --> 00:06.990
So we've made it through that war zone of string and numbered types in particular the number types are

00:06.990 --> 00:13.480
always a bit hairy but we're moving on to something equally finicky dates and times.

00:14.010 --> 00:20.370
Often the bane of many programmers existence having to deal with time zones and synchronizing things

00:20.370 --> 00:24.530
across the world in the daylight savings it's just a nightmare Piers.

00:24.540 --> 00:28.210
Fortunately my school makes it relatively simple for us.

00:28.260 --> 00:33.780
I'm going to show you how in the next couple of videos this is going to be serious here not just a single

00:33.780 --> 00:34.590
video.

00:34.590 --> 00:39.120
And in fact in this first video I'm just going to give you a quick overview of the three important data

00:39.120 --> 00:41.200
types that will take a look at.

00:41.210 --> 00:48.900
So the first one is called data and what it does is it just stores a date without a time.

00:48.900 --> 00:55.700
So the format looks like this year year year year year dash month month dash date day.

00:55.830 --> 01:01.520
So 1999 dash 11 dash twenty five or something.

01:01.540 --> 01:05.340
So as it states here that that stores that date but no time.

01:05.340 --> 01:12.480
So there are instances where you may use this things like a birthday if you're asking a user to sign

01:12.480 --> 01:14.840
up and specify their birthday.

01:15.420 --> 01:17.280
Most users don't know the time.

01:17.340 --> 01:18.210
Well I don't know.

01:18.300 --> 01:19.020
I don't know the time.

01:19.020 --> 01:22.380
I was born I know a lot of people do but it doesn't matter.

01:22.710 --> 01:26.170
At least for most web sites it doesn't matter what time someone was born.

01:26.280 --> 01:27.420
You just need that date.

01:29.100 --> 01:32.800
Another option is the opposite the time.

01:32.970 --> 01:38.310
So time is another data type that stores values with the time but no date.

01:38.310 --> 01:43.740
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

01:43.740 --> 01:46.890
many things that you just need to store time.

01:47.040 --> 01:56.730
Maybe if you're I don't know if you're working with reminders maybe like I'm at a loss really.

01:56.730 --> 02:05.280
But basically store times and the syntax the format is our our dash or excuse me Colan minute minute

02:05.380 --> 02:10.440
colon second second and the final data type and the one that I use.

02:10.440 --> 02:14.540
By far the most out of all of them is Date Time.

02:14.760 --> 02:18.800
Not very creative and just date plus time does what it sounds like.

02:18.840 --> 02:25.280
Which I also realize I'm saying way too often in this course but it stores values with the date and

02:25.290 --> 02:26.060
time.

02:26.280 --> 02:28.940
And this is pretty useful and you get both.

02:29.010 --> 02:31.570
And like I said this is what I use the most.

02:31.590 --> 02:36.090
So when you're doing things like I don't know when to use or signed up for your site or when something

02:36.090 --> 02:37.670
was last updated.

02:37.950 --> 02:42.150
You know when a profile picture was last updated or when somebody commented on a Facebook post.

02:42.150 --> 02:47.750
Those are all stored with date times because just having the time on its own isn't that useful.

02:48.180 --> 02:50.100
So let's go with this Facebook example.

02:50.100 --> 02:55.760
You know if I comment on someone's post Facebook doesn't just store the time that I commented.

02:55.770 --> 03:00.200
Ten thirty nine P.M. say because it's just not that useful to them.

03:00.270 --> 03:05.640
You know I think what Facebook does is it displays things like how many days ago or hours or minutes

03:05.640 --> 03:13.050
ago something you know I commented it will say like Colt commented three seconds ago 20 minutes ago

03:13.260 --> 03:18.790
two days ago last month and it needs more than just a time to figure that out.

03:18.810 --> 03:21.110
Right and needs the time and that day.

03:21.220 --> 03:29.970
So daytime very very useful and used all the time in applications and a really common use case in programming

03:29.970 --> 03:37.680
in general is when you have a column let's say a row in a database and a table and it's created you

03:37.680 --> 03:43.560
often want to just store the date and time it was created so that you can then go and sort things based

03:43.560 --> 03:45.940
off of how new they are and how old they are.

03:46.790 --> 03:47.860
So very easy.

03:47.900 --> 03:53.870
You know if you're working on comments for example going back to Facebook Facebook comments are displayed

03:53.960 --> 03:56.490
in the order that they were written and posted.

03:56.630 --> 04:03.470
So you need to store that created at time so that your date time is coming and the format is also what

04:03.470 --> 04:10.700
you probably expect year year year year dash month month dash date day which is the date part and then

04:10.700 --> 04:17.440
a space hour hour Cohen minute minute Colan second second which is the time component.

04:17.480 --> 04:23.720
OK so we talked about those three we didn't see them in action but we saw that they exist date and time

04:24.140 --> 04:29.540
and date time and again I use date time the most we'll be using it the most it's the most versatile

04:30.140 --> 04:30.880
and the most useful.
