Download as txt, pdf, or txt
Download as txt, pdf, or txt
You are on page 1of 1

-----------------------------------------------------------------------------------

-----------------------------------------------------------------------
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~DATE AND TIME
API~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-----------------------------------------------------------------------------------
-----------------------------------------------------------------------

>> If we want to work with date and time for that we have to import time package
(java.time.*)
>>Deafult Pattern to print date : YYYY-MM-DD
>> Default Pattern to print Time : Hr:Min:Sec:NanoSec
>> Default Pattern to print Date and Time both : YYYY-MM-DD | Hr:Min:Sec:NanoSec

-----------------------------------------------------------------------------------
-----------------------------------------------------------------------

>> METHODS OF LocalDate :

1. now() method :
It is used to print current or time of a system.
2. of() method :
It is used to pass your own date and time
3. parse() method :
It is used to conver a string into a date and time.

:: methods TO add Days, Month, Year etc :

1. public LocalDate plusYear(long yearsToAdd)


2.
-----------------------------------------------------------------------------------
-----------------------------------------------------------------------

You might also like