Java Date Examples

Here I am going to cover all the java date class related conversions and manipulations. The java.util.Date class represents a specific instant in time, with millisecond precision.Although the Date class is intended to reflect coordinated universal time (UTC), it may not do so exactly, depending on the host environment of the Java Virtual Machine. Nearly all modern operating systems assume that 1 day = 24 × 60 × 60 = 86400 seconds in all cases.

Java Date Examples

String To Date Conversion

Date To String Conversion

Number of Days between two Dates

Joda-Time provides a quality replacement for the Java date and time classes. Using this api we can easily calculate number of days between two dayes.

You can download this api  using below maven dependency

Compare Two Dates

Difference between java.sql.Date and java.util.Date

java.sql.Date just represent DATE without time information while java.util.Date represent both Date and Time information. This is the major differences why java.util.Date can not directly map to java.sql.Date.

I hope above java date examples will be really useful java beginners. If you have any comments please use the below comment section.

About mohan

This is Mohan Jayapalan author of TechPages Blog.I am a part time blogger and Currently working for private Software Concern.

© Copyright 2010-2016 www.techpages.org · All Rights Reserved · Powered by WordPress ·