Skip to content

πŸ“…LibDate.h is a comprehensive C++ library for manipulating dates, allowing basic operations such as adding, subtracting, comparing, calculating differences, printing calendars, and checking working days or holidays, all in a simple and flexible way without the need for external libraries.

Notifications You must be signed in to change notification settings

7mee3d/DateToolkit

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

4 Commits
Β 
Β 
Β 
Β 

Repository files navigation

πŸ“… LibDate: C++ Date Utility Library

LibDate.h is a powerful C++ header-only library designed to handle a wide range of date and calendar operations, including calculating day differences, leap years, weekdays, and formatting dates with ease.


βœ… Key Features

  • πŸ—“οΈ Leap year detection.
  • πŸ“† Calculate total days, hours, minutes, or seconds in months and years.
  • βž• Easily add days, weeks, months, or years to a date.
  • βž– Subtract time periods from a date (e.g., go back one month).
  • πŸ“… Print full calendars for a month or year.
  • πŸ”„ Compare two dates: is one before, after, or equal to another?
  • 🧠 Work with date periods (start/end date) and calculate overlaps.
  • πŸ”€ Format dates using custom string templates (dd/mm/yyyy, Month dd yyyy, etc.)
  • πŸ’Ό Recognize business days and weekends.

πŸ“¦ Library Contents

🧾 Enumerations

  • enDayOfWeek: Enum for days from Sunday to Saturday.
  • enMounth: Enum for months from January to December.
  • enCompareTwoDate: Enum to compare two dates (BEFORE, EQUAL, AFTER).

πŸ“Œ Structures

  • stDateInformation: Represents a date (day, month, year).
  • stPeriodOfDate: Represents a time period between two dates.

πŸ› οΈ Key Functions

βœ… Date Validation & Basic Calculations

  • bool isLeapYear(int year)
  • int numberOfDayInYear(int year)
  • int numberOfDayInMonth(int year, int month)

⏳ Time Unit Calculations

  • calcNumberOfHourInYear, calcNumberOfMinutsInYear, calcNumberOfSecoundsInYear
  • calcNumberOfHourInMonth, calcNumberOfMinutsInMonth, calcNumberOfSecoundsInMonth

βž• Date Increment Functions

  • increasingDayByOne
  • increasingXWeek, increasingOneMonth, increasingXMonth
  • increasingXYear, increasingOneDecade, increasingOneCentury, increasingOneMillennium

βž– Date Decrement Functions

  • decreasingDayByOne
  • decreasingWeekX, decreasingOneMonth, decreasingMonthX
  • decreasingYearX, decreasingOneDecade, decreasingOneMilleninum

πŸ“… Calendar Printing

  • printCalenderOfMonth(year, month)
  • printAllMonthCalenderAccordingYear(year)

🧠 Comparison & Logic

  • cheakDateOneLessThanDateTwo
  • IsDate1EqualDate2
  • Date1AfterDate2
  • compareTwoDates
  • isOverLapTwoDate
  • isDateWithinPeriod

🧾 Input/Output & Formatting

  • printDateFormat(date, separator)
  • replaseDatekDAY_kMONTH_kYEAR_FormatDate(date, format)
  • convertRecordToLine(date)
  • splitDateInformation(string date)
  • fillDateInformation(vector<string>)

πŸ“† Weekday and Month Name Utilities

  • findTheOrderOfDayInWeek
  • findDayOfWeekString(index, fullName)
  • findNameMounthString(index, fullName)

πŸ“‰ Date Differences

  • calcDifferanceBetweenTwoDate
  • vacationDays(date1, date2)
  • dayUntilEndOfWeek, dayUntilEndOfMonth, dayUntilEndOfYear

πŸ”€ Supported Date Format Examples

replaseDatekDAY_kMONTH_kYEAR_FormatDate(date, "dd/mm/yyyy")
replaseDatekDAY_kMONTH_kYEAR_FormatDate(date, "DDDD, dd Month yyyy")
replaseDatekDAY_kMONTH_kYEAR_FormatDate(date, "dd-MMM-yy")

πŸ‘¨πŸ’» Author

Ahmed Jehad Ahmed

πŸ”— GitHub Profile

πŸ“§ Email Contact

About

πŸ“…LibDate.h is a comprehensive C++ library for manipulating dates, allowing basic operations such as adding, subtracting, comparing, calculating differences, printing calendars, and checking working days or holidays, all in a simple and flexible way without the need for external libraries.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages