📄 datetime.h
字号:
/*************************************************************************** datetime.h - description ------------------- begin : Fri Jul 20 2001 copyright : (C) 2001 by Mark email : alben@yeah.net ***************************************************************************//*************************************************************************** * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * ***************************************************************************/#ifndef DATETIME_H#define DATETIME_H#include <time.h>#include <string>class CDateTime{protected: time_t m_tTime; struct tm m_stTime; public: CDateTime(); CDateTime(time_t tTime); CDateTime(const struct tm& stTime); CDateTime(int iYear, int iMonth, int iDay, int iHour = 0, int iMinute = 0, int iSecond = 0); time_t GetValue() { return m_tTime; } const struct tm& GetStruct() { return m_stTime; } int Year() { return m_stTime.tm_year + 1900; } int Month() { return m_stTime.tm_mon + 1; } int Day() { return m_stTime.tm_mday; } int Hour() { return m_stTime.tm_hour; } int Minute() { return m_stTime.tm_min; } int Second() { return m_stTime.tm_sec; } int DayOfWeek() { return m_stTime.tm_wday; } int DayOfYear() { return m_stTime.tm_yday; } string ShortDateTime(); string LongDateTime(char chSep1 = '-', char chSep2 = ':'); string ShortDate(); string LongDate(char chSep = '-');};#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -