Java Date Programs

  1. Print LocalDate in yyyy-mm-dd format.
  2. Count the number of days between two given years.
  3. Java Program to print LocalTime HH:mm:ss
  4. Java program to print LocalTime and LocalDate yyyy-MM-dd HH:mm:ss
  5. Write a Java program to print ZonedDateTime E MMM yyyy HH:mm:ss.SSSZ
  6. Write a Java program to print OffsetTime HH:mm:ss,Z
  7. Write a Java program to display combine local date and time in a single object
  8. Write a Java program to display current date without time and current time without date
  9. Write a Java program to calculate the difference between two dates in days
  10. Write a Java program to get seconds since Specific Year (Solution)
  11. Write a Java program to convert a unix timestamp to date (Solution)
  12. Write a Java program to extract date, time from the date string (Solution)
  13. Write a Java program to get today’s date at midnight time
  14. Write a Java program to get the next and previous Friday
  15. Write a Java program to calculate your age
  16. Write a Java program to compute the difference between two datetime (Hours, Minutes, Milliseconds, Seconds and Nanoseconds)
  17. Write a Java program to compute the difference between two dates (Years, Months, Days)
  18. Write a Java program to convert a string to date
  19. Write a Java program to display the date time information before some hours and minutes from current date time.
  20. Write a Java program to get the information of a given time
  21. Write a Java program to get the information of current/given month
    • Current Month of Number : 6
    • Number of Days in Month : 30
    • Maximum Number of Days in Month : 30
    • First Month of the Quarter : APRIL
  22. Write a Java program to get the information of current/given year
    • Current Year : 2001
    • Is Current Year or leap Year ? false
    • Number of Days in the year : 365 days
  23. Write a Java program to display the dates in the specified formats
  24. Write a Java program to get the months remaining in the year
  25. Write a Java program to get the dates 10 days before and after today
  26. Write a Java program to get the current time in all the available time zones
  27. Write a Java program to get current timestamp
  28. Write a Java program to get year and months between two dates
  29. Write a Java program to get a date before and after 1 year compares to the current date
  30. Write a Java program to get a date after 2 weeks
  31. Write a Java program to add some hours to the current time
  32. Write a Java program to get the current local time
  33. Write a Java program to get a day of the week of a specific date
  34. Write a Java program to get localized day in week name
  35. Write a Java program to get Current Locale day in week name
  36. Write a Java program to get the number of days of a month
  37. Write a Java program to get the name of the first and last day of a month
  38. Write a Java program to calculate the first and last day of each week
  39. Write a Java program to get the last date of the month
  40. Write a Java program to get the last day of the current month
  41. Write a Java program to get current full date and time
  42. Write a Java program to get the current time in New York
  43. Write a Java program to get the minimum value of year, month, week, date from the current date of a default calendar
  44.  Write a Java program to get the maximum value of the year, month, week, date from the current date of a default calendar
  45. Write a Java program to get and display information (year, month, day, hour, minute) of a default calendar
  46. Write a Java program to create a Date object using the Calendar class
  47. Write a Java Program to Generate Month Calendar of Any Year
  48. Write a Java Program to Generate One Year Calendar
  49. Write a Java Program to Decrement a Month using the Calendar Class
  50. Write a Java Program to Increment a Month using the Calendar Class
  51. Write a Java Program to Get individual components of the current time
  52. Write a Java Program to Compare time using equals() method
  53. Write a Java Program to Compare time using compareTo() method
  54. Write a Java Program to Add years to the current date
  55. Write a Java Program to Add months to the current date
  56. Write a Java Program to Subtract days from the current date
  57. Write a Java Program to Add days to the current date
  58. Write a Java Program to Get the current day number of a month using the get() method of Calendar class
  59. Write a Java Program to Get the current year using the get() method of Calendar class
  60. Write a Java Program to Print the current date-time using Calendar class
  61. Write a Java Program to Create a LocalDate object from the object of Date class
  62. Write a Java Program to Parse individual components of date from the current date
  63. Write a Java Program to Parse individual components of date from a string
  64. Write a Java Program to Compare dates using the Date.equals() method
  65. Write a Java Program to Compare dates using Date.compareTo() method
  66. Write a Java Program to Get a date from milliseconds using the Date.setTime() method
  67. Write a Java Program to Get a date from milliseconds using Date() constructor
  68. Write a Java Program to Get milliseconds from the specified date
  69. Write a Java Program to Convert ‘java.util.Date’ into ‘java.sql.Date’
  70. Write a Java Program to Get current system date and time in Java
  71. Write a Java Program to get elapsed time in seconds and milliseconds