Questions And Answers

More Tutorials

Java Date and Time

Date & Time in Java

java time -> package for date & time in java from java onwards
Before java 8, java util package used to hold the date time class now these classes are deprecated

How java stores a Date?

Date in java is stored in the form of a long numer. This long number holds the number of miliseconds passed since 1 jan 1970
Java assumes that 1900 is the start year which means it calculates years passed since 1900 whenever We ask it for years passed
System current Time Millis () returns no of sound passed Once no. of ms are calculated, we can calculate minutes, seconds & years passed



public class date {
    public static void main(String[] args) {


In this page (written and validated by ) you learned about Java Date and Time . What's Next? If you are interested in completing Java tutorial, your next topic will be learning about: Java Date Class.

Incorrect info or code snippet? We take very seriously the accuracy of the information provided on our website. We also make sure to test all snippets and examples provided for each section. If you find any incorrect information, please send us an email about the issue:

Share On:

Mockstacks was launched to help beginners learn programming languages; the site is optimized with no Ads as, Ads might slow down the performance. We also don't track any personal information; we also don't collect any kind of data unless the user provided us a corrected information. Almost all examples have been tested. Tutorials, references, and examples are constantly reviewed to avoid errors, but we cannot warrant full correctness of all content. By using, you agree to have read and accepted our terms of use, cookies and privacy policy.