Write a
program to create an append-only log file that can be used to log messages. The
log file should be able to grow to a certain threshold size before it is backed
up and a new log file… Read More
Working with dates and times is an essential part of software development, and Java provides a powerful set of tools for handling them. However, date formatting can be a tricky business, and… Read More
Introduction
In this article, we will discuss and dwell on how to compare dates in Java. The problem statement is : Check if a Date is between two dates in Java. This roughly translates to G… Read More
Object serialization is the mechanism of converting object into byte stream. Where as the reverse process of recreating the object from those serialized bytes is known as deserialization. I… Read More
In this post, I will be sharing how to fix java.text.ParseException in Java with examples. According to Oracle docs, this exception signals that an error has been reached unexpectedly while… Read More
There are two ways to get the last modified date of a file in Java. Using File.lastModified() method- Using this method you can get the file's last modified timestamp. Using Files.readAt… Read More
Below snippet convert the Date instance from one time zone to other.public static final String convert(Date date, TimeZone timeZone) { DateFormat format = new SimpleDateFormat("yyyy-MM-dd… Read More
Below snippet return the Date object from the given year, month and day.private static Date getDate(Integer year, Integer month, Integer day) throws ParseException { String dateStr = year +… Read More
Introduction to Kotlin println
In kotlin println is one of the default statements that can be used to print the statement automatically one by one or nextLine of the code that will be appen… Read More
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 emp… Read More
Along with lambda expressions, streams, and several minor goodies, Java 8 has also introduced brand new Date and Time API, and in this tutorial, we will learn how to use Java 8 Date Time API… Read More
Here is a quick Java tip to get the current date, month, year, and day of the week from the Java program. Java provides a rich Date and Time API though having thread-safety issue but it's ri… Read More
Program
import java.sql.Timestamp;
import java.util.Date;
public class DateTimestamp {
public static void main(String args[]){
Date date = new Date… Read More
In this post, we will see how to get day name of week from date in java.
There are multiple ways to get day name from date in java. Let’s go through them.
Using java.util.Date
You can… Read More