⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 xdatetime.txt

📁 我自己用的Delphi函数单元 具体说明见打包文件的HELP目录下面
💻 TXT
字号:
unit xDateTime;

   TDateFormatType = set of (dfNormal,dfChinese,dfNoFormat,dfYearAndMonth,dfMonthAndDay,
                            tfNormal,tfLong,tfChinese,tfNoFormat,tfExact,tfAccumulate);

//------------------------------------------------------------------//
//取得年份字符串
function GetYearString(dt: TDateTime ; bPad : Boolean = True):String;
//------------------------------------------------------------------//
//取得月份字符串
function GetMonthString(dt: TDateTime ; bPad : Boolean = True):String;
//------------------------------------------------------------------//
//取得第几日字符串
function GetDayString(dt: TDateTime ; bPad : Boolean = True):String;
//------------------------------------------------------------------//
//取得年
function GetYear(dt: TDateTime):Integer;
//------------------------------------------------------------------//
//取得月
function GetMonth(dt: TDateTime):Integer;
//------------------------------------------------------------------//
//取得日
function GetDay(dt: TDateTime):Integer;
//------------------------------------------------------------------//
//取得小时字符串
function GetHourString(dt: TDateTime ; bPad : Boolean = True): String;
//------------------------------------------------------------------//
//取得分钟字符串
function GetMinuteString(dt: TDateTime ; bPad : Boolean = True): String;
//------------------------------------------------------------------//
//取得秒字符串
function GetSecondString(dt: TDateTime ; bPad : Boolean = True): String;
//------------------------------------------------------------------//
//取得毫秒字符串
function GetMSecondString(dt: TDateTime ; bPad : Boolean = True): String;
//------------------------------------------------------------------//
//取得时数
function GetHour(dt: TDateTime): Integer;
//------------------------------------------------------------------//
//取得分
function GetMinute(dt: TDateTime): Integer;
//------------------------------------------------------------------//
//取得秒
function GetSecond(dt: TDateTime): Integer;
//------------------------------------------------------------------//
//取得毫秒
function GetMSecond(dt: TDateTime): Integer;
//------------------------------------------------------------------//
//一年的第一天
function  GetBeginOfYear(dt: TDateTime): TDateTime;
//------------------------------------------------------------------//
//一年的最后一天
function  GetEndOfYear(dt: TDateTime): TDateTime;
//------------------------------------------------------------------//
//一个月的第一天
function  GetBeginOfMonth(dt: TDateTime): TDateTime;
//------------------------------------------------------------------//
//一个月的最后一天
function  GetEndOfMonth(dt: TDateTime): TDateTime;
//------------------------------------------------------------------//
//上一年最后一天
function GetPrevYeard(dt: TDateTime): TDateTime;
//------------------------------------------------------------------//
//下一年第一天
function GetNextYeard(dt: TDateTime): TDateTime;
//------------------------------------------------------------------//
//上一月最后一天
function GetPrevMonthd(dt: TDateTime): TDateTime;
//------------------------------------------------------------------//
//下一月第一天
function GetNextMonthd(dt: TDateTime): TDateTime;
//------------------------------------------------------------------//
//取得日期字符串,格式由df定义
function GetDateString(dt: TDateTime ; df : TDateFormatType = [dfNormal]):String;
//------------------------------------------------------------------//
//取得时间字符串,格式由df定义
function GetTimeString(dt: TDateTime ; df : TDateFormatType = [tfNormal]):String;
function IsLeapYear(dt: TDateTime): Boolean;
//------------------------------------------------------------------//
//计算给定月份的天数
function DaysInMonth(dt: TDateTime): Integer;
//------------------------------------------------------------------//
 //设置日期,失败时返回当前日期
function SetDate(s:String): TDateTime;
//------------------------------------------------------------------//
//为字符串加上时间戳
function AddTimeStamp(const S: string): string;
//------------------------------------------------------------------//
//C++的time_t格式转换为Delphi的TDateTime格式。
function TimeTtoTDateTime(TimeT: Integer): TDateTime;
//------------------------------------------------------------------//
//将取得的时、分、秒转换为秒。
function TimeToSecond(const hour, minute, sec: Integer): Integer;
//------------------------------------------------------------------//
//将取得秒转换为时、分、秒。
procedure SecondToTime(const secs: Integer; var hour, minute, sec: Word);
//------------------------------------------------------------------//
//将取得的秒转换为时、分、秒字符串。
function SecondToTimeStr(secs: Integer): string;

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -