tpDate类
Utils
2025-07-05
介绍
日期类,提供日期相关操作
基础信息
头文件: | include <tpDate.h> |
---|---|
Cmake: | None |
发布版本: | V0.1.0 |
继承类: | |
派生类: |
Public 成员函数
tpDate() | ||
---|---|---|
tpDate(const int32_t &y, const int32_t &m, const int32_t &d) | ||
~tpDate() | ||
year() const | 获取日期的年份 | |
month() const | 获取日期的月份 | |
day() const | 获取日期的天 | |
setYear(const int32_t &year) | 设置年份 | |
setMonth(const int32_t &month) | 设置月份 | |
setDay(const int32_t &day) | 设置日期 | |
dayOfWeek() const | 获取日期是当周的第几天 | |
dayOfYear() const | 获取当前日期在该年中的天数 | |
daysInMonth() const | 获取当前日期所在月份的天数 | |
daysInYear() const | 返回当前日期所在年份共计多少天 | |
tpDate tpDate::addDays | addDays(const uint64_t &days) const | 基于当前日期添加指定天数 |
tpDate tpDate::addMonths | addMonths(const uint32_t &months) const | 基于当前日期添加指定月数 |
tpDate tpDate::addYears | addYears(const uint32_t &years) const | 基于当前日期添加指定年数 |
tpString | toString(const tpString &format) const | 将日期对象转换为字符串 |
toJulianDay() const | 转换为儒略日 | |
tpDate & tpDate::operator= | operator=(const tpDate &other) noexcept | |
operator==(const tpDate &other) const | ||
operator<(const tpDate &other) const | ||
operator!=(const tpDate &other) const | ||
operator<=(const tpDate &other) const | ||
operator>(const tpDate &other) const | ||
operator>=(const tpDate &other) const | ||
static tpDate tpDate::fromString | fromString(const tpString &s, const tpString &format) | 将日期字符串转换日期对象 |
static tpDate tpDate::currentDate | currentDate() | 获取当前日期 |
成员函数说明
tpDate::tpDate()
暂无注释...
tpDate::tpDate(const int32_t &y, const int32_t &m, const int32_t &d)
暂无注释...
tpDate::~tpDate()
暂无注释...
int32_t tpDate::year() const
点击查看...
获取日期的年份
返回值:
年份
int32_t tpDate::month() const
点击查看...
获取日期的月份
返回值:
月份
int32_t tpDate::day() const
点击查看...
获取日期的天
返回值:
天数
void tpDate::setYear(const int32_t &year)
点击查看...
设置年份
void tpDate::setMonth(const int32_t &month)
点击查看...
设置月份
void tpDate::setDay(const int32_t &day)
点击查看...
设置日期
int32_t tpDate::dayOfWeek() const
点击查看...
获取日期是当周的第几天
返回值:
当周的第几天,1为星期一,7为星期日
int32_t tpDate::dayOfYear() const
点击查看...
获取当前日期在该年中的天数
返回值:
当年的第几天
int32_t tpDate::daysInMonth() const
点击查看...
获取当前日期所在月份的天数
返回值:
当月有多少天
int32_t tpDate::daysInYear() const
点击查看...
返回当前日期所在年份共计多少天
返回值:
天数365;366
tpDate tpDate::addDays(const uint64_t &days) const
点击查看...
基于当前日期添加指定天数
返回值:
返回叠加后的新日期对象
tpDate tpDate::addMonths(const uint32_t &months) const
点击查看...
基于当前日期添加指定月数
返回值:
返回叠加后的新日期对象
tpDate tpDate::addYears(const uint32_t &years) const
点击查看...
基于当前日期添加指定年数
返回值:
返回叠加后的新日期对象
tpString tpDate::toString(const tpString &format) const
点击查看...
将日期对象转换为字符串
返回值:
日期对象
int64_t tpDate::toJulianDay() const
点击查看...
转换为儒略日
返回值:
儒略日
tpDate & tpDate::operator=(const tpDate &other) noexcept
暂无注释...
bool tpDate::operator==(const tpDate &other) const
暂无注释...
bool tpDate::operator<(const tpDate &other) const
暂无注释...
bool tpDate::operator!=(const tpDate &other) const
暂无注释...
bool tpDate::operator<=(const tpDate &other) const
暂无注释...
bool tpDate::operator>(const tpDate &other) const
暂无注释...
bool tpDate::operator>=(const tpDate &other) const
暂无注释...
static tpDate tpDate::fromString(const tpString &s, const tpString &format)
点击查看...
将日期字符串转换日期对象
返回值:
tpDate对象
static tpDate tpDate::currentDate()
点击查看...
获取当前日期
返回值:
当前日期对象