1
00:00:01,210 --> 00:00:03,500
Hello again, my dear friends.

2
00:00:04,360 --> 00:00:07,930
So in this section, we're going to learn daytime functions now.

3
00:00:07,950 --> 00:00:09,690
There just happen to be quite a few of them.

4
00:00:10,030 --> 00:00:11,620
So let me list a few.

5
00:00:12,760 --> 00:00:15,370
We're going to learn, get date function.

6
00:00:17,330 --> 00:00:18,410
Is date function.

7
00:00:19,930 --> 00:00:21,310
Do I have a date function?

8
00:00:21,910 --> 00:00:22,660
No, I'm just kidding.

9
00:00:23,740 --> 00:00:30,250
Day, month and year functions, date, part, function, date, name, function.

10
00:00:31,370 --> 00:00:32,780
Date and function.

11
00:00:34,270 --> 00:00:37,120
As well as the date diff function.

12
00:00:39,640 --> 00:00:42,460
So why don't we get started with the get date function?

13
00:00:45,390 --> 00:00:51,270
Now, the get date function will return the current system date and time of the operating system on

14
00:00:51,270 --> 00:00:54,090
which the Escorial servers running dynamic since.

15
00:00:55,090 --> 00:00:59,860
So let's jump over and into SSME and get the date and time.

16
00:01:01,130 --> 00:01:04,790
The select get date keywords will get the date and time of the system.

17
00:01:05,760 --> 00:01:09,000
They get the key word must be finished with Prince's.

18
00:01:10,600 --> 00:01:11,800
And then execute the query.

19
00:01:13,040 --> 00:01:15,970
So here is the current date and time of our machine.

20
00:01:17,800 --> 00:01:23,440
And this function returns the date and time of the system on which the Escorial servers running, so

21
00:01:23,440 --> 00:01:25,320
obviously yours may be a little different.

22
00:01:27,320 --> 00:01:31,310
Now, the next function that we're going to learn is the is date function.

23
00:01:32,120 --> 00:01:36,470
So the is date function checks and expression and returns one.

24
00:01:37,750 --> 00:01:42,850
If the expression is a valid date, otherwise zero will be returned.

25
00:01:44,560 --> 00:01:46,960
So let's have a look at the syntax of this function.

26
00:01:48,690 --> 00:01:51,180
And it takes an expression in parentheses.

27
00:01:53,950 --> 00:01:57,080
His date function takes only one parameter.

28
00:01:57,550 --> 00:02:01,390
So in this example, we will use the get date function as a parameter.

29
00:02:04,190 --> 00:02:06,950
Now, if you excuse the query, it will return one.

30
00:02:07,460 --> 00:02:09,920
This means that the expression is a valid date.

31
00:02:11,000 --> 00:02:14,300
So the get date function returns the date and time and the system.

32
00:02:15,650 --> 00:02:18,050
The expression can also be used as a parameter.

33
00:02:19,530 --> 00:02:25,890
So this query will also return one, because the expression is a valid date.

34
00:02:29,040 --> 00:02:32,640
So now let's see what happens when you use a string as an expression.

35
00:02:33,780 --> 00:02:36,480
For instance, a string can be SQL Server.

36
00:02:37,540 --> 00:02:45,750
Let's execute this query and it will return zero because the specified expression is not a valid date

37
00:02:46,290 --> 00:02:47,250
day function.

38
00:02:48,940 --> 00:02:55,060
So this function returns the day of the month for a specified date, and it's going to return a number

39
00:02:55,060 --> 00:02:59,200
between one and 31, of course, depending on the month.

40
00:02:59,890 --> 00:03:01,630
So here is a syntax.

41
00:03:02,720 --> 00:03:06,140
And it will take a validate and return it's day.

42
00:03:07,250 --> 00:03:09,410
And the day of this date is 20.

43
00:03:10,840 --> 00:03:11,710
Month function.

44
00:03:12,940 --> 00:03:17,230
Of course, it returns a month of a specified date as an integer.

45
00:03:18,350 --> 00:03:21,490
That will return a number between one and 12.

46
00:03:22,460 --> 00:03:25,280
And here is a syntax of that.

47
00:03:26,610 --> 00:03:30,240
And it'll take a validate and return its month value.

48
00:03:31,220 --> 00:03:33,140
And the month of this date is one.

49
00:03:34,240 --> 00:03:35,140
The year function.

50
00:03:36,270 --> 00:03:40,560
So this function will return the year of a specified date as an integer.

51
00:03:42,010 --> 00:03:49,900
And here's the syntax of it, and it takes the validate and returns, it's your value, your this date

52
00:03:49,900 --> 00:03:51,040
is 20-20.

53
00:03:51,970 --> 00:03:55,240
So let's do an example for each function.

54
00:03:56,440 --> 00:04:03,580
Now, the day function returns the day the specified date, so let's make sure the expression specified

55
00:04:03,580 --> 00:04:04,510
is valid date.

56
00:04:05,400 --> 00:04:10,880
If we execute the query, 20 will be returned as the day of this expression, so that's correct.

57
00:04:14,260 --> 00:04:18,760
The month function will return one as a month of this expression.

58
00:04:22,710 --> 00:04:27,180
And the year function will return 2020 as the year this expression.

59
00:04:32,190 --> 00:04:33,450
That part function.

60
00:04:34,800 --> 00:04:39,570
So the date part function will return the part of date or time.

61
00:04:41,040 --> 00:04:47,220
So this function will return an integer, which is part of a date such as day, month or year.

62
00:04:48,670 --> 00:04:54,430
The date part function takes two parameters, the first parameter is the part of the date to be extracted

63
00:04:54,430 --> 00:04:59,290
and then the second parameter is the date from which the date part is extracted.

64
00:05:00,560 --> 00:05:05,570
Now, as you might imagine, there are many date parts that can be used as the first parameter.

65
00:05:06,810 --> 00:05:11,210
For instance, there are three ways to get the year value from the specified date.

66
00:05:12,830 --> 00:05:21,950
The year keyword or for why letters or double why letters return the same value.

67
00:05:22,890 --> 00:05:30,210
And of course, you can use any of them to get your value, so the other date parts are quarter, month,

68
00:05:31,140 --> 00:05:37,260
day of your day, week, weekday, hour, minute, second, even millisecond.

69
00:05:38,650 --> 00:05:44,980
Now, the date part function will take two parameters, the first parameter will be the year and the

70
00:05:44,980 --> 00:05:47,350
second one must be a valid date.

71
00:05:55,990 --> 00:06:03,460
So if we asked you the query, we will get 20/20 because we have specified the year as the first parameter.

72
00:06:05,490 --> 00:06:09,150
So instead of using the turkey word, we could use the double why?

73
00:06:10,300 --> 00:06:14,630
Or the four y letters to get the same result.

74
00:06:16,210 --> 00:06:23,530
And the day keyword will return the day of this date time as an integer, and it'll return 20 in this

75
00:06:23,530 --> 00:06:23,830
case.

76
00:06:24,960 --> 00:06:28,680
The month keyword will return the month of this date time as an integer.

77
00:06:29,800 --> 00:06:31,780
And it's going to return one.

78
00:06:33,780 --> 00:06:38,910
The our keyword will return the hour of this date time as an integer, and it'll return for.

79
00:06:42,570 --> 00:06:49,380
And when we press a letter M from the keyword, all other date parts, starting with the letter M will

80
00:06:49,380 --> 00:06:50,010
be listed.

81
00:06:52,200 --> 00:07:00,570
The am I keyword will return the minute of this date time as an integer, and it returns 55.

82
00:07:03,040 --> 00:07:09,700
We can use a minute keyword instead of the main keyword to get the minutes of this date time as an integer.

83
00:07:11,040 --> 00:07:15,300
So to wrap that up, the date part function returns integer values.

84
00:07:17,930 --> 00:07:19,910
So here's the date name aFunction.

85
00:07:21,680 --> 00:07:29,120
The date name function will return the party date or time, and his function returns a string, which

86
00:07:29,120 --> 00:07:31,580
is part of a date such as day, month and year.

87
00:07:33,970 --> 00:07:40,270
The date name function takes two parameters the parameters of this function are the same as the parameters

88
00:07:40,270 --> 00:07:41,920
of the date part function, however.

89
00:07:43,940 --> 00:07:48,500
Year, quarter, month, day of the year, day, week, so on.

90
00:07:50,380 --> 00:07:56,440
The date name function takes two parameters, the first parameter will be year, and I'll put the second

91
00:07:56,710 --> 00:07:58,840
one, it must be a valid date.

92
00:08:01,320 --> 00:08:06,840
So if we execute the query with a minute keyword as parameter, we'll get 55.

93
00:08:07,790 --> 00:08:09,110
Like the date part function.

94
00:08:11,650 --> 00:08:15,970
And the day keyword will return the day of this daytime as a ed.

95
00:08:17,220 --> 00:08:18,900
And in return, 20.

96
00:08:19,860 --> 00:08:21,330
Just like the date part function.

97
00:08:23,900 --> 00:08:30,040
Now, let me show you something here, when we use the month as a parameter, it will not return.

98
00:08:30,100 --> 00:08:33,890
One, the name of the first month will be returned, right.

99
00:08:34,250 --> 00:08:35,550
It'll return January.

100
00:08:36,410 --> 00:08:41,880
So here's the main difference between the date name and the date part you might have even anticipated.

101
00:08:41,900 --> 00:08:42,260
Now.

102
00:08:44,040 --> 00:08:49,350
So while the date part function returns, a month is an integer, the daytime function returns the name

103
00:08:49,350 --> 00:08:49,770
of the month.

104
00:08:55,630 --> 00:08:59,800
Now, if we use the weekday for both functions.

105
00:09:02,920 --> 00:09:10,270
The date part function will return the two as a weekday, but the date name function will return Monday

106
00:09:10,720 --> 00:09:11,680
as a weekday.

107
00:09:14,600 --> 00:09:18,320
The day of the year keyword will return 20 for both functions.

108
00:09:25,580 --> 00:09:33,080
And check this out, the letter Q or double Q or quarter as a keyword will return the quarter a year.

109
00:09:36,850 --> 00:09:43,900
So that wraps up the date name function, it returns string values if it's possible, otherwise it will

110
00:09:43,900 --> 00:09:47,080
return integers just like the date part function.

111
00:09:48,700 --> 00:09:49,960
The date and function.

112
00:09:51,060 --> 00:09:58,230
So the date and function will display the date and time by adding or subtracting date and time intervals.

113
00:09:59,860 --> 00:10:02,200
So this function will take three parameters.

114
00:10:03,640 --> 00:10:09,910
The first one is the part of the date to which the date and function will add the number.

115
00:10:11,170 --> 00:10:17,730
The second parameter is the number, which is an integer number to be added to the first parameter of

116
00:10:17,730 --> 00:10:18,790
the given validate.

117
00:10:19,760 --> 00:10:27,170
So the value evaluates to a decimal or float the function date and will truncate the decimal fraction

118
00:10:27,170 --> 00:10:30,440
part and it will not round the number in this case.

119
00:10:31,620 --> 00:10:36,210
And the last parameter is the expression, and it must be a valid date.

120
00:10:37,190 --> 00:10:43,640
So these given keywords, such as month, day of year, day, week, hour or one of the others can be

121
00:10:43,640 --> 00:10:48,110
used instead of using the year keyword as the first parameter.

122
00:10:50,340 --> 00:10:52,380
Let's see what it looks like, an SS, a mass.

123
00:10:54,570 --> 00:11:01,950
The data add function takes three parameters, the day is the first parameter, the number five is the

124
00:11:01,950 --> 00:11:05,340
second one, and the date is the last parameter.

125
00:11:09,570 --> 00:11:17,130
So this query will return the date five days after the date and time from the current date and time

126
00:11:17,310 --> 00:11:18,390
and Ms.

127
00:11:18,420 --> 00:11:19,350
Escarole server.

128
00:11:20,710 --> 00:11:26,500
And when we execute it, we will see that the day of the date has been changed to 25.

129
00:11:28,030 --> 00:11:34,990
Now, the number minus five will decrease the day of the date and it will be changed to 15.

130
00:11:38,200 --> 00:11:40,700
Now, the first parameter has been changed to month.

131
00:11:41,380 --> 00:11:43,750
It means that the month will be changed.

132
00:11:45,870 --> 00:11:51,780
And this query will return after five months and it will be changed to six.

133
00:11:53,150 --> 00:11:59,440
If the first parameter has been changed to the year keyword, it means that the year will be changed.

134
00:12:01,170 --> 00:12:09,630
And this query will return the after five years and it will be changed to 20, 25.

135
00:12:12,900 --> 00:12:16,620
And the last function that we're going to learn here is the date dysfunction.

136
00:12:17,910 --> 00:12:26,250
So this function will display the date and time between two dates, so this function accepts three parameters.

137
00:12:27,410 --> 00:12:33,350
The first one is the part of the date, for instance, a year, a quarter, a month, a week that you

138
00:12:33,350 --> 00:12:39,440
want to compare between date one, which is a start date and date two, which is the end date.

139
00:12:40,560 --> 00:12:48,060
The second and the final parameters are date one and date to which are the dates to be compared.

140
00:12:49,390 --> 00:12:56,830
Now, instead of using the year keyword, we can use quarter, month, day, week, our minute one of

141
00:12:56,860 --> 00:12:57,340
the others.

142
00:12:59,680 --> 00:13:05,380
And the day dysfunction will return a difference in the date part between the two dates.

143
00:13:06,850 --> 00:13:13,630
And this function takes three parameters, the keyword will be the first parameter and the other parameters

144
00:13:13,630 --> 00:13:14,920
must be valid dates.

145
00:13:16,330 --> 00:13:22,860
And then this query will return the difference of years between 1989 and 2020.

146
00:13:25,070 --> 00:13:30,020
And then that way, when we execute it, the result will be 31 years.

147
00:13:31,770 --> 00:13:34,860
And that's the difference between these two dates.

148
00:13:36,140 --> 00:13:39,170
Now, what about the number of days between these two dates?

149
00:13:41,750 --> 00:13:47,150
By using the day function as the first parameter, we can return the total number of days between these

150
00:13:47,150 --> 00:13:49,720
two dates and here's that result.

151
00:13:53,060 --> 00:13:58,390
You can also find a number of days you have lived since your birthday with the date dysfunction.

152
00:13:58,610 --> 00:13:59,740
Oh, that's always fun.

153
00:14:02,630 --> 00:14:09,380
Even more, the hours or seconds or even milliseconds that you've lived can be found by using this function

154
00:14:09,380 --> 00:14:10,700
in escarole server.

155
00:14:14,190 --> 00:14:20,880
So in this case, the get date function should be used instead of the end date to calculate and up to

156
00:14:20,880 --> 00:14:21,660
date value.

157
00:14:28,090 --> 00:14:28,670
Excellent.

158
00:14:28,690 --> 00:14:32,260
So this is a section that we learned that time functions.

159
00:14:33,280 --> 00:14:39,520
Now, in the following section, we're going to learn daytime convergence, so I want to see their.
