The java.util.Calendar class was added in Java on JDK 1.4 in an attempt to fix some flaws of the java.util.Date class. It did make some ta...
Tampilkan postingan dengan label date and time tutorial. Tampilkan semua postingan
Tampilkan postingan dengan label date and time tutorial. Tampilkan semua postingan
How to create LocalDateTime in Java 8 - Example
The LocalDateTime is a new class introduced in Java 8 new Date and Time API. This class is in java.time package and it represents both dat...
How to convert java.util.Date to java.sql.Timestamp?
You can convert a java.util.Date to java.sql.Timestamp value by using the getTime() method of Date class. This method return the long mil...
How to convert java.util.Date to java.time.LocalDate in Java 8 - Example
The easiest way to convert a java.util.Date to java.time.LocalDate is via Instant, which is the equivalent class of java.util.Date in JDK 8....
3 ways to get number of months and year between two dates in Java?
Earlier I have talked about how to calculate a number of days between two dates in Java ( see here ), and now you will learn how to get the ...
Why Timestamp cannot be used in place of Date in Java?
One of the tricky question from Java Interview is, "Can we pass a Timestamp instance to a method expecting java.util.Date? " , it...
How to add, subtract days, months, years, hours from Date and Time in Java
Adding days, hours, month or years to dates is a common task in Java. java.util.Calendar can be used to perform Date and Time arithmetic in...
How to convert milliseconds to Date in Java - tutorial example
Do you want to convert milliseconds to Date in Java ? Actually java.util.Date is internally specified in milliseconds from epoch. So any da...
How to get current date, month, year and day of week in Java program
Here is quick Java tip to get current date, month, year and day of week from Java program. Java provides a rich Date and Time API though hav...