Skip to content

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

 
 
 

Contributors

Languages