WEBVTT

00:00.840 --> 00:01.440
Hi everyone.

00:01.440 --> 00:02.760
Welcome back to this tutorial.

00:02.760 --> 00:06.510
In this tutorial, we will explore the local date class.

00:06.690 --> 00:09.630
The first step is I'm going to create a class called.

00:10.850 --> 00:14.150
Local date example.

00:15.060 --> 00:19.590
And then I'm going to make this class executable by adding public static void main method.

00:21.430 --> 00:23.050
Put this in presentation mode.

00:23.770 --> 00:24.310
There we go.

00:24.490 --> 00:29.080
The first step is we are going to create an instance of local data.

00:29.590 --> 00:30.550
Local date.

00:30.820 --> 00:31.840
Local date.

00:32.140 --> 00:37.630
Equal to new art, new local date dot now.

00:37.660 --> 00:40.240
So this is what we did in the previous tutorial to.

00:41.300 --> 00:41.930
When I printed.

00:45.300 --> 00:45.960
Local date.

00:47.730 --> 00:52.290
We know this is going to print the current machines local date.

00:55.710 --> 00:56.140
There you go.

00:56.160 --> 00:59.190
It printed the machine's current date.

00:59.280 --> 01:02.280
What are the other options of creating this?

01:02.310 --> 01:03.740
There are many more options.

01:03.750 --> 01:06.600
Let's focus some of the options in this tutorial.

01:06.840 --> 01:08.760
Local date Dot.

01:09.120 --> 01:10.500
As soon as you click the dot.

01:10.530 --> 01:13.860
The time zones are something which I'll be covering it in the future.

01:13.860 --> 01:16.230
Tutorials for now I'm going to keep it on hold.

01:16.260 --> 01:18.930
Let's explore the off method.

01:19.230 --> 01:19.800
There you go.

01:19.800 --> 01:23.010
If you have if you see the off method, it takes three arguments.

01:23.010 --> 01:23.520
Right?

01:23.550 --> 01:26.370
Let's given this, it takes three arguments.

01:26.370 --> 01:27.560
What are the three arguments?

01:27.570 --> 01:31.860
The three arguments are year, month and day of month.

01:32.340 --> 01:33.990
So the first one is year.

01:34.810 --> 01:41.470
And then the month I'm going to give the month as zero seven and then the day I'm going to give it as

01:41.470 --> 01:42.110
17th.

01:42.130 --> 01:47.710
The current machines time date is 16th and I gave the date as 17 here.

01:47.950 --> 01:51.050
So as soon as you make this call, what is this method going to return?

01:51.070 --> 01:54.460
This is going to return an instance of local date.

01:56.290 --> 01:57.820
So I'm going to give local date.

01:57.820 --> 01:59.050
I'm going to give it a name.

01:59.050 --> 02:00.820
It's going to be local date one.

02:01.270 --> 02:02.740
And let's print this.

02:04.720 --> 02:10.610
Printed going to print the current the date of this local date.

02:10.630 --> 02:14.740
One instance is going to be 17 because that's what we are passing here.

02:14.770 --> 02:19.420
The day of the month is 17 and it printed the value as 17.

02:20.920 --> 02:26.590
Let's explore the another of method version of creating the local data of.

02:27.930 --> 02:29.590
There are two different versions of it.

02:29.610 --> 02:32.640
One is the year day and another one is the Epoch Day.

02:32.670 --> 02:35.550
Epoch Day is something which we will cover in the future tutorials.

02:35.550 --> 02:40.050
For now, we will cover the year Day takes in two parameters.

02:40.050 --> 02:46.740
One is the year I'm going to give the value as 2018 and the next parameter is the day of the year.

02:46.770 --> 02:52.200
Let's see, I'm going to pass the value as 365 and then see what is the value that it is going to print.

02:52.380 --> 02:56.640
Local date, local date to equal to This is good.

02:56.880 --> 02:59.340
I'm going to print and check what is the result.

03:02.410 --> 03:05.740
The result that it is going to print is going to be.

03:07.670 --> 03:11.750
31, 12, 2018, which is the last day of the year.

03:11.750 --> 03:17.420
So in this version, if you pass the value as zero two and then check, the result is going to give

03:17.420 --> 03:20.000
you Jan second 2018 as a result.

03:20.150 --> 03:20.840
There you go.

03:20.840 --> 03:27.410
So this takes in the day of the year and then gives you the appropriate date as a response.

03:27.770 --> 03:31.910
Now we know how to create the date instance.

03:31.910 --> 03:35.510
Let's say you want to read the values from these date.

03:35.660 --> 03:41.180
Let's say you want to read just the month or just the day of the year or day of the week.

03:41.210 --> 03:42.020
How do we do it?

03:42.260 --> 03:43.100
So.

03:44.130 --> 03:45.960
Let's talk about how to get.

03:47.470 --> 03:50.140
Values from local data.

03:51.910 --> 03:52.360
Okay.

03:52.720 --> 03:55.330
The first one is I want to get the month.

03:56.110 --> 03:56.980
How can I do that?

03:57.430 --> 03:59.530
The way to do it is by.

04:00.470 --> 04:02.180
Following the get month method.

04:02.180 --> 04:05.810
If you take a look at it as soon as I typed in git, there are a lot of options here.

04:05.840 --> 04:13.490
Get year, get day of year, get day of week, month value month, chronology, day of month, get era

04:13.490 --> 04:13.970
long.

04:14.000 --> 04:16.580
For now I'm going to focus just a few methods.

04:16.580 --> 04:23.030
I would highly recommend you to explore all the methods and then find out what you can read from this

04:23.030 --> 04:24.140
date instance.

04:24.170 --> 04:25.940
I'm going to do get month.

04:27.160 --> 04:28.180
Get month.

04:29.700 --> 04:30.600
Let's print and check.

04:30.600 --> 04:31.170
What is that?

04:31.170 --> 04:32.720
It is going to return.

04:35.020 --> 04:35.770
On this.

04:37.700 --> 04:42.530
The value it printed is July because that is the current month of this.

04:43.400 --> 04:44.090
Local date.

04:44.690 --> 04:49.460
Let's say you want to get the month value, so not the month name.

04:49.460 --> 04:51.740
You want to know the month value.

04:51.770 --> 04:58.640
In that case, you can call this get month value method that is going to give you the month value as

04:58.640 --> 04:59.570
a response.

04:59.570 --> 05:01.970
The month value is seven.

05:02.690 --> 05:05.570
Let's say you want to read the day of the week.

05:05.660 --> 05:05.780
What?

05:05.780 --> 05:06.440
Can we do it?

05:07.310 --> 05:08.510
Copy this here.

05:09.530 --> 05:11.510
Paul get day of the week.

05:11.910 --> 05:15.710
Let's see, what is the response that it is going to return as part of it?

05:17.490 --> 05:21.000
So it returned the day of the week as Monday.

05:21.950 --> 05:26.390
Let's say you want to check what is a day of the year like how we calculated it here.

05:26.390 --> 05:26.990
Right.

05:27.020 --> 05:30.890
We want to calculate that get day of year.

05:33.530 --> 05:34.340
This year.

05:34.670 --> 05:35.270
And this.

05:36.160 --> 05:44.560
It gave you the value as 197 197 is a current day of the year and you can play around with all the other

05:44.560 --> 05:51.910
methods and then please shoot me a question or post any questions in the Q&amp;A if you have any doubts

05:51.910 --> 05:52.570
on this.

05:52.690 --> 05:55.960
And then let's take a look at the next method.

05:56.050 --> 05:59.170
What are the other different ways of getting the value?

05:59.170 --> 05:59.590
Here?

05:59.590 --> 06:03.190
We use the methods that this local date instance supports, right?

06:03.190 --> 06:06.580
Let's say we want to just call the get method.

06:07.030 --> 06:11.350
So there is a get method which takes in an input call temporal field here.

06:11.470 --> 06:12.900
Right, let's go and check.

06:12.910 --> 06:16.780
So this one is accepting a field called temporal field.

06:17.200 --> 06:18.970
So what is a temporal field?

06:19.720 --> 06:21.370
There is something called Chrono Field.

06:21.370 --> 06:27.730
If you go to this class, this class implements the temporal field, let's say, what are the values

06:27.730 --> 06:29.560
that this temporal field has?

06:30.720 --> 06:30.990
Sorry.

06:30.990 --> 06:31.710
It's not a class.

06:31.710 --> 06:32.480
It's a enum.

06:32.490 --> 06:35.850
It has a lot of different values, like nanosecond and nanotech.

06:36.330 --> 06:41.700
So what we want in this one, let's say you want to just get the day of the month.

06:42.540 --> 06:43.140
Right.

06:43.260 --> 06:45.990
We just passed that and is going to give you.

06:48.100 --> 06:49.030
Day of month.

06:50.280 --> 06:51.690
Using git.

06:53.070 --> 06:53.580
Right.

06:53.700 --> 07:01.440
And then if you run this program, it is going to give you the day of the month of this particular.

07:02.900 --> 07:03.980
Date instance.

07:05.050 --> 07:11.830
Let's explore some of the other properties, like modifying the date and what are the different scenarios

07:11.830 --> 07:13.720
it supports in the future tutorials.

07:13.720 --> 07:15.720
But this we came to the end of this tutorial.

07:15.730 --> 07:16.810
Thank you for watching.
