Skip to content

YuriiJavaDev/JavaBasics_Task_205_V0.1

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 

Repository files navigation

Historical Date Tracker: Yesterday (JavaBasics_Task_205_V0.1)

📖 Description

This project focuses on date manipulation within the Java Time API. It demonstrates how to perform basic date arithmetic by moving the current system date one step into the past. This functionality is a core requirement for applications dealing with historical records, logs, or daily reports.

📋 Requirements Compliance

  • Current Date: Successfully retrieves today's date using LocalDate.now().
  • Date Arithmetic: Uses the minusDays(1) method to calculate the date of the previous day.
  • Variable Declaration: Implements variables today and yesterday of type LocalDate.
  • Output: Displays the calculated yesterday's date in the console.
  • Goal: Master relative date navigation in Java.

🚀 Architectural Stack

  • Java 8+ (java.time.LocalDate)

🏗️ Implementation Details

The LocalDate class is immutable, meaning methods like minusDays() do not change the existing object but return a new LocalDate instance representing the result. This ensures data integrity across the application.

📋 Expected result

Yesterday was: 2026-03-03

💻 Code Example

Project Structure:

src/com/yurii/pavlenko/
                └── Solution.java

Code

package com.yurii.pavlenko;

import java.time.LocalDate;

public class Solution {

    public static void main(String[] args) {

        LocalDate today = LocalDate.now();
        LocalDate yesterday = today.minusDays(1);

        System.out.println("Yesterday was: " + yesterday);
    }
}

⚖️ License

This project is licensed under the MIT License.

Copyright (c) 2026 Yurii Pavlenko

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files...

License: MIT

About

This is a tutorial project. JavaBasics_Task_205_V0.1 Date arithmetic implementation: calculating and displaying the previous day's date using the LocalDate minusDays method. 040326_1157

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages