WEBVTT

00:00.440 --> 00:01.140
Either.

00:01.350 --> 00:04.470
So I have a small confession to make at the beginning of this video.

00:04.500 --> 00:06.260
This is not my first time recording this.

00:06.390 --> 00:11.870
I recorded this about a month ago along with all the other videos in this section and something happened.

00:11.880 --> 00:13.500
I didn't save it correctly.

00:13.830 --> 00:15.270
Maybe I accidentally deleted it.

00:15.270 --> 00:16.650
My cat stuff on the keyboard.

00:16.650 --> 00:17.750
I have no idea.

00:18.030 --> 00:20.570
But the original video here is gone.

00:20.760 --> 00:22.610
And normally that wouldn't be a problem.

00:22.680 --> 00:23.680
It's happened before.

00:23.910 --> 00:26.510
Or I just rerecord a section because I'm not happy with it.

00:26.540 --> 00:27.870
You know that's not too bad.

00:27.870 --> 00:28.910
It's easy to do.

00:29.130 --> 00:34.530
But since this has to do with dates and in particular it has to do with these three date functions that

00:34.530 --> 00:35.550
I'm going to show you.

00:35.580 --> 00:40.030
Basically they give us the current date the current time and the current date time.

00:40.230 --> 00:45.810
You'll see in the videos following this one that the code that I ran when I was recording it the first

00:45.810 --> 00:50.450
time resulted in different dates and different times than what you'll see right now.

00:50.520 --> 00:52.530
So it's not a big deal at all.

00:52.530 --> 00:57.270
It's just evidence that I recorded them on different times but I wanted to just let you know what to

00:57.270 --> 00:57.960
expect.

00:58.170 --> 00:58.460
OK.

00:58.480 --> 01:04.260
And the last video we inserted these to where we manually created or basically wrote out the dates the

01:04.260 --> 01:09.410
time and the date time and then in the initial recorded version of this video.

01:09.660 --> 01:17.250
This is the new person that I inserted and this birthdate birth time and birth date time were all done

01:17.250 --> 01:22.400
using these three functions here that give the current birth or the current date.

01:22.410 --> 01:29.280
So at the time it was April 21st and the time was 7 12 and this is the date time and so I used these

01:29.700 --> 01:30.720
to generate this.

01:30.720 --> 01:38.140
So in the next video you will see this person with toaster birth date April 20th 21st and so on.

01:38.340 --> 01:42.340
But in this video where I'm actually showing you that creation I'm having to rerecord it.

01:42.360 --> 01:44.380
So there's just a small discrepancy.

01:44.430 --> 01:47.060
Other than that everything else will be the same.

01:47.070 --> 01:49.770
So let me show you these three methods here that are really useful.

01:49.770 --> 02:00.810
Simple things but Kuhr date gives current date as I said her time gives the current time and then now

02:01.550 --> 02:03.780
gives current date time.

02:04.260 --> 02:06.770
So let's try one of them just on their own.

02:06.870 --> 02:14.640
If you did something like select her date you'll see that I'm actually recording this on 5:12 May 12th.

02:14.640 --> 02:17.950
So not quite a month later but a couple of weeks later.

02:18.030 --> 02:19.950
So if we do the same thing with her time

02:23.390 --> 02:26.290
we get the time and then if we do.

02:26.280 --> 02:30.720
Now we get the daytime.

02:30.840 --> 02:35.580
So using them on their own is not useful really just to select the current time it's much easier just

02:35.580 --> 02:41.510
to look at your watch but they become useful when we use them in conjunction with insert statements.

02:41.730 --> 02:47.480
So things like when we're inserting a new user and we want to save the time that the user was inserted.

02:47.670 --> 02:54.600
What we could do is basically write an insert into and we'll do people let's do our select start from

02:54.600 --> 02:55.740
people.

02:56.430 --> 02:56.800
OK.

02:56.820 --> 03:05.740
So we'll do insert into people first date birth time and birth date time.

03:05.850 --> 03:13.050
And so I think the hypothetical story I gave was that toaster was my son my first son and he was born

03:13.290 --> 03:15.450
exactly at the moment when I hit enter.

03:15.480 --> 03:16.820
So we'll do the same thing here.

03:16.860 --> 03:20.860
Inserting into people birthdate birth time birth date time.

03:21.080 --> 03:27.210
This would be my new son and this one's name is me actually I'd name as well.

03:27.660 --> 03:29.430
Oh boy I'm really bad at naming things.

03:29.430 --> 03:33.170
You can tell I named my cat blue which is blue still.

03:33.180 --> 03:34.780
By the way you didn't catch that.

03:35.010 --> 03:42.900
OK so I'll name him micro-wave and then rather than writing out to date here what I'll do instead is

03:42.900 --> 03:45.950
for the birth date I just say curred date.

03:46.000 --> 03:54.530
And then for the birth time I'll just use her time and then for birth date time I use the now and out

03:54.530 --> 04:00.600
of all these I end up using now the most often because as I've mentioned before we use daytime's a lot.

04:00.610 --> 04:09.530
OK so if we just run this right now and insert that and now you are select star from people you can

04:09.530 --> 04:16.070
see that micro-wave now has the date the time the date time that reflect exactly when I inserted this.

04:16.070 --> 04:21.240
Just a couple of seconds ago and that's pretty much all there is to these three nice simple functions.

04:21.260 --> 04:26.540
Another way that we use them by the way is not just to insert data with current dates and times and

04:26.540 --> 04:30.430
so on but also to compare data to the current time.

04:30.560 --> 04:33.050
So I'll show you how to do some basic data math.

04:33.080 --> 04:38.070
We'll be able to figure out you know how long ago something was compared to now.

04:38.120 --> 04:43.220
And so we need to be able to refer to now where we want to figure out how many dates or how many days

04:43.280 --> 04:46.170
somebody was born ago compared to the current date.

04:46.190 --> 04:49.350
So we need that current date in order to help out with that.

04:49.590 --> 04:50.100
OK.

04:50.150 --> 04:55.280
So the last thing I'll do here just for continuity sake is the microwave that we have toaster Larry

04:55.280 --> 05:00.800
and Padam which is what I had in the original recording so that the next video here hopefully will be

05:00.800 --> 05:02.090
relatively seamless.

05:02.210 --> 05:06.610
So I'm getting rid of my son I'm sorry microwave it failed you.

05:06.800 --> 05:07.210
OK.

05:07.370 --> 05:10.330
Now he's gone and we're back to these three.

05:10.520 --> 05:10.970
All right.

05:10.970 --> 05:13.250
So that's her date card time and now.
