1
00:00:00,420 --> 00:00:01,020
Hey there.

2
00:00:01,230 --> 00:00:04,080
So I have a small confession to make at the beginning of this video.

3
00:00:04,380 --> 00:00:06,310
This is not my first time recording this.

4
00:00:06,330 --> 00:00:11,550
I recorded this about a month ago, along with all the other videos in this section, and something

5
00:00:11,550 --> 00:00:11,910
happened.

6
00:00:11,910 --> 00:00:13,290
I didn't save it correctly.

7
00:00:13,290 --> 00:00:15,300
I maybe accidentally deleted it.

8
00:00:15,370 --> 00:00:16,650
My cat stepped on the keyboard.

9
00:00:16,650 --> 00:00:22,350
I have no idea, but the original video here is gone and normally that wouldn't be a problem.

10
00:00:22,680 --> 00:00:23,780
It's happened before.

11
00:00:23,790 --> 00:00:26,460
Or I just rerecord a section because I'm not happy with it.

12
00:00:26,790 --> 00:00:27,870
That's not too bad.

13
00:00:27,870 --> 00:00:28,920
It's easy to do.

14
00:00:28,920 --> 00:00:34,560
But since this has to do with dates and in particular it has to do with these three date functions that

15
00:00:34,560 --> 00:00:35,420
I'm going to show you.

16
00:00:35,430 --> 00:00:39,960
Basically, they give us the current date, the current time and the current date time.

17
00:00:40,080 --> 00:00:45,840
You'll see in the videos following this one that the code that I ran when I was recording it the first

18
00:00:45,840 --> 00:00:50,460
time resulted in different dates and different times than what you'll see right now.

19
00:00:50,460 --> 00:00:52,560
So it's not a big deal at all.

20
00:00:52,560 --> 00:00:57,180
It's just evidence that I recorded them on different times, but I wanted to just let you know what

21
00:00:57,180 --> 00:00:57,990
to expect.

22
00:00:58,110 --> 00:01:03,390
Okay, so in the last video, we inserted these to where we manually created or basically wrote out

23
00:01:03,390 --> 00:01:05,610
the dates, the time and the date time.

24
00:01:06,090 --> 00:01:12,330
And then in the initial recorded version of this video, this is the new person that I inserted.

25
00:01:12,330 --> 00:01:19,170
And this birth date, birth time and birth date time were all done using these three functions here

26
00:01:19,170 --> 00:01:22,290
that give the current birth, the current date.

27
00:01:22,290 --> 00:01:27,990
So at the time it was April 21st and the time was 712 and this was the date time.

28
00:01:27,990 --> 00:01:30,600
And so I used these to generate this.

29
00:01:30,600 --> 00:01:38,160
So in the next video you will see this person with Towcester birth date, April 20, 21st and so on.

30
00:01:38,160 --> 00:01:42,180
But in this video where I'm actually showing you the creation, I'm having to rerecord it.

31
00:01:42,180 --> 00:01:44,190
So there's just a small discrepancy.

32
00:01:44,340 --> 00:01:46,740
Other than that, everything else will be the same.

33
00:01:46,920 --> 00:01:48,780
So let me show you these three methods here.

34
00:01:48,780 --> 00:01:54,570
They're really useful, simple things, but Curr Date gives current date.

35
00:01:55,440 --> 00:02:03,510
As I said, current time gives the current time and then now gives current date time.

36
00:02:04,140 --> 00:02:06,690
So let's try one of them just on their own.

37
00:02:06,720 --> 00:02:14,220
If you did something like Select Curr Date, you'll see that I'm actually recording this on 512 May

38
00:02:14,220 --> 00:02:17,130
12, so not quite a month later, but a couple of weeks later.

39
00:02:17,940 --> 00:02:20,250
So if we do the same thing with Curr Time.

40
00:02:23,410 --> 00:02:30,660
We get the time and then if we do now we get the date time.

41
00:02:30,670 --> 00:02:33,460
So using them on their own is not useful really.

42
00:02:33,550 --> 00:02:34,810
Just to select the current time.

43
00:02:34,810 --> 00:02:36,580
It's much easier just to look at your watch.

44
00:02:36,670 --> 00:02:41,410
But they become useful when we use them in conjunction with insert statements.

45
00:02:41,740 --> 00: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.

46
00:02:47,500 --> 00:02:54,610
What we could do is basically write an insert into and we'll do people let's do our select start from

47
00:02:54,610 --> 00:02:55,270
people.

48
00:02:56,830 --> 00:03:05,740
So we'll do insert into people birth date, birth time and birth date time.

49
00:03:05,740 --> 00:03:12,610
And so I think the hypothetical story I gave was that toaster was my son, my first son, and he was

50
00:03:12,610 --> 00:03:15,400
born exactly at the moment when I hit enter.

51
00:03:15,400 --> 00:03:20,320
So we'll do the same thing here, inserting into people birth date, birth time, birth date time.

52
00:03:21,100 --> 00:03:26,800
This will be my new son and this one's name is let me actually add a name as well.

53
00:03:27,640 --> 00:03:28,060
Oh, boy.

54
00:03:28,060 --> 00:03:33,340
I'm really bad at naming things, as you can tell, and named my cat blue, which is blue steel, by

55
00:03:33,340 --> 00:03:34,660
the way, if you didn't catch that.

56
00:03:34,990 --> 00:03:37,630
Okay, so I'll name him microwave.

57
00:03:38,560 --> 00:03:43,630
And then rather than writing out the giant date here, what I'll do instead is for the birth date.

58
00:03:43,630 --> 00:03:52,330
I just say her date and then for the birth time I'll just use cur time and then for birth date time

59
00:03:52,330 --> 00:03:53,410
I use now.

60
00:03:54,180 --> 00:03:58,410
And out of all of these, I end up using now the most often, because as I've mentioned before, we

61
00:03:58,410 --> 00:03:59,700
use date times a lot.

62
00:04:00,530 --> 00:04:00,820
Okay.

63
00:04:00,890 --> 00:04:09,560
So if we just run this right now and insert that and now we do our select star from people, you can

64
00:04:09,560 --> 00:04:15,890
see that microwave now has the date, the time and the date time that reflect exactly when I inserted

65
00:04:15,890 --> 00:04:20,990
this just a couple of seconds ago, and that's pretty much all there is to these three nice little functions.

66
00:04:21,260 --> 00:04:26,480
Another way that we use them, by the way, is not just to insert data with current dates and times

67
00:04:26,480 --> 00:04:30,440
and so on, but also to compare data to the current time.

68
00:04:30,440 --> 00:04:33,050
So I'll show you how to do some basic date math.

69
00:04:33,050 --> 00:04:38,090
We'll be able to figure out how long ago something was compared to now.

70
00:04:38,090 --> 00:04:42,800
And so we need to be able to refer to now or we want to figure out how many dates, you know, how many

71
00:04:42,800 --> 00:04:46,100
days somebody was born ago compared to the current date.

72
00:04:46,100 --> 00:04:49,640
So we need that current date in order to help out with that math.

73
00:04:49,670 --> 00:04:50,080
Okay.

74
00:04:50,090 --> 00:04:54,890
So the last thing I'll do here just for continuity sake is delete microwave so that we have toaster,

75
00:04:54,890 --> 00:05:00,590
Larry and Padma, which is what I had in the original recording, so that the next video here hopefully

76
00:05:00,590 --> 00:05:02,090
will be relatively seamless.

77
00:05:02,090 --> 00:05:04,040
So I'm getting rid of my sun.

78
00:05:04,040 --> 00:05:05,330
I'm sorry, microwave.

79
00:05:05,750 --> 00:05:06,680
I failed you.

80
00:05:06,710 --> 00:05:10,400
Okay, so now he's gone and we're back to these three.

81
00:05:10,400 --> 00:05:13,520
All right, so that's Curr Date Card Time and now.

