Given a string in date format, the task is to convert this String into an actual date. Here the main concept is the parse() method… Read More
Tag Archives: date-time-program
You are given two string (dd-mm-yyyy) representing two date, you have to find number of all weekdays present in between given dates.(both inclusive) Examples: Input… Read More
Converting the string to Date and DateTime uses several functions/methods like strtotime(), getDate(). We will see what these functions do. strtotime() – This is basically… Read More
Given a time in a 24-hour clock (military time), convert it to a 12-hour clock format. Note: Midnight is 00:00:00 on a 24-hour clock and… Read More
Given a date, you have to print the day of the week. Examples: Input : 2018 3 26 Output : Mon Input : 2010 8… Read More
Given milliseconds. The task is to write a program in Java to convert Milliseconds to a Date that Displays the date in dd MMM yyyy… Read More
Given the initial clock time h1:m1 and the present clock time h2:m2, denoting hour and minutes in 24-hours clock format. The present clock time h2:m2… Read More
The mktime() is an inbuilt C++ function which converts the local calendar time to the time since epoch and returns the value as an object… Read More
Comparing dates is quite easy in Python. Dates can be easily compared using comparison operators (like , =, != etc.). Let’s see how to compare… Read More
Given a time in 12-hour AM/PM format, convert it to military (24-hour) time. Note : Midnight is 12:00:00 AM on a 12-hour clock and 00:00:00… Read More
We use java.util.regex.Pattern.compile(String regex) method which compiles the given regular expression into a pattern. Here regex is the expression to be compiled. // Java program… Read More
In Java, there is a built-in class known as the Date class and we can import java.time package to work with date and time API.… Read More
java.util.Calendar.get() method is a method of java.util.Calendar class. The Calendar class provides some methods for implementing a concrete calendar system outside the package. Some examples… Read More
java.util.Calendar.equals() is a method in Calendar class of java.util package. The method compares this Calendar to the specified Object.The method returns true if this object… Read More
Given an integer n(in seconds).Convert it into days, hours, minutes and seconds.Examples: Input : 369121517Output : 4272 days 5 hours 45 minutes 17 secondsInput :… Read More