Professional Documents
Culture Documents
Date and Time
Date and Time
-----------------------------------------------------------------------
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~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
-----------------------------------------------------------------------------------
-----------------------------------------------------------------------
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.