Hello, in this Java video we are going to cover date and time. So the first thing we need to do is actually import a new module. So we're going to say in Java dot util, so Java dot util, dot date, like so. Let's use it so we create a date object, so we'll call it D and I go equals new date. And now we can use this simple system, dot. When flying and I put day two strings on want to get the string of it.
This will print out the date. So friends are Friday, September 7, it is a Friday. It is September 7, and it is 125. And it's 46. So And it is British son, Tom Sawyer, UK and it is 2019. As you can see, right, that is just changed to 26 minutes, a couple seconds, as you can see.
So there are a few of the methods as well do the number one to d dot get time. So this returns basically the number of milliseconds since versus Jerry 1970. And this is also called epoch time. And this has a lot of significance in programming system. system. And we'll proceed get get day to get time that like so many different functions overdue this printed out, and that's the epoch time.
So the number of milliseconds since 1979. So we then we use this whole time in computers, because ran about that sort of time late 60s, early 70s You know, the first you know, set of computers were going online. And I mean, just like us. And that's just, you know, consider a long enough time ago, and because it adds significant service for us. So we can check out most of the System dot out dot print. And another great thing about it is because it's a standard, let's say you're storing in a database, or a commenting system, usually on comments, you have like a date posted, for example, instead of storing or like this.
This is a particular format. If we store it as epoch time, just a number of milliseconds is the first of January 1970. We got formatting how however we want. That's the beauty of it. It allows a lot flexibility we do d.we do d dot What should we check d dot year, so this will get the year I'm guessing this is deprecated. So it's just the Application Manager.
The warning now. Hundred and 19 you often wonder 99 right, it is 2018 last level Look at that. I'll have to you know, check the days totally with you. You know get and that's exactly. I said so don't get Yeah, that the one I chose you wasn't it? Yeah it is.
So if I were to do get year again, so it's trying to validate the result of suit trousers from 1900 Yeah, that makes 119 years. Okay, so that's fair enough. If you wanted the actual date, you could do you know, plus 1900 and there's like a variety of other methods here. I recommend you going through the intelligence. I will provide a link with this video so you can see more features of the date. object, I sort of want to just leave it here and I want to leave you to experiment with it because that's what programming is all about.
So thanks for watching. If you have any more questions, feel free to reach out and I look forward to seeing you in the next video.