https://github.com/quantumsheep/cpp-date
C++ date library
https://github.com/quantumsheep/cpp-date
cpp date library
Last synced: about 1 year ago
JSON representation
C++ date library
- Host: GitHub
- URL: https://github.com/quantumsheep/cpp-date
- Owner: quantumsheep
- License: mit
- Created: 2020-05-19T18:12:19.000Z (about 6 years ago)
- Default Branch: master
- Last Pushed: 2020-05-19T18:33:45.000Z (about 6 years ago)
- Last Synced: 2025-02-10T09:11:19.759Z (over 1 year ago)
- Topics: cpp, date, library
- Language: C++
- Size: 1.95 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# C++ Date
The purpose of this library is to provide a reliable date implementation for C++. It started because of the outstanding complexity to generate epochs from raw dates.
It provides header-only implementation so nothing to compile, you just need to include `date/date.hpp` in your code.
# Usage
These declarations are simplified for documentation purpose, they may vary in the actual implementation.
## Date
### Constructors
Creates a date.
```cpp
Date(size_t day, size_t month, size_t year)
```
Creates a date from standard's `time_point`.
```cpp
Date(std::chrono::system_clock::time_point time)
```
### Static methods
Creates a new date with of current time.
```cpp
Date::now()
```
### Methods
Convert the date to epoch.
```cpp
std::chrono::seconds epoch()
```
### Operators
```cpp
Date > Date
```
```cpp
Date < Date
```