• Get last day of month in java
    04 February

    Get last day of Month in java

    Learn about how to get last day of month in java. There are times when you need to get last day of month to process data at the end of each month. For example: Processing salaries of the employee in your company. There are multiple ways to get last day of month in java Ways […]

  • Convert Date to LocalDate in java
    12 January

    Java Date to LocalDate

    In this post, we will see how to convert Date to LocalDate in java. Sometimes, we may need to convert Date to new Java 8 APIs and vice versa. There are multiple ways to convert Date to LocalDate in java. Read also: Convert LocalDate to Date in java [toc] Using toInstant() method of Date class […]

  • Convert LocalDate to Date in java
    11 January

    Java LocalDate to Date

    In this post, we will see how to convert LocalDate to Date. Java 8 has introduced a lot of new APIs for Date and time. [toc] There can be many ways to convert Java LocalDateTime to date. Using Instant object You can convert LocalDate to Date using Instant object which we can from Zone. Here […]

  • 30 December

    How to Get Day from Date in Java

    Learn about how to get day name of week from date in java

  • 22 December

    How to Add Days to Date in Java

    Learn about how to add days to Date using Calendar and LocalDate in java.

  • 23 March

    Get current timestamp in java

    In this post, we will see how to get current timestamp in java. There are multiple ways to get current timestamp in java. [toc] Using Java 8’s Instant class There are three ways to get timestamp using Java 8‘s java.time.Instant class. Using Instant.now() // get current instant Instant instanceNow1 = Instant.now(); Using date.toInstant() Date date=new […]

  • 22 April

    How to calculate difference between two dates in java

    In this post, we will see how to calculate difference between two dates. Sometimes we have requirement to find no. of days between two dates or no. of hours between two dates. Java Program: package com.org.arpit.java2blog; import java.text.DecimalFormat; import java.text.SimpleDateFormat; import java.util.Date; /** * @author java2blog.com * Arpit Mandliya * */ public class DateDiff { […]

  • 25 January

    How to convert String to Date in java

    In this post, we will see how to convert String to Date object in java. It is used when we have formatted String and need to convert it to Date object.You may also check how to convert Date to String Java program: package org.arpit.java2blog; import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.Date; public class StringToDateExample { public static void […]

  • 25 January

    How to Convert Date to String in Java

    In this post, we will see how to convert date to string in java. It is more of utility which is mostly used while displaying dates in different string formats while generating any pdf or excel reports.You may also check how to convert string to date Java program: package org.arpit.java2blog; import java.util.Date; import java.text.SimpleDateFormat; import […]

Subscribe to our newletter

Get quality tutorials to your inbox. Subscribe now.