System.DateUtils 3. IsPM、IsAM 判断是否为上、下午

编译版本:Delphi XE7

function IsPM(const AValue: TDateTime): Boolean; inline;
function IsAM(const AValue: TDateTime): Boolean;

implementation

// 判断是否为下午

function IsPM(const AValue: TDateTime): Boolean;
begin
  Result := HourOf(AValue) >= 12; // 判断时间数大于等于12点,即为下午
end;

// 判断是否为上午
function IsAM(const AValue: TDateTime): Boolean;
begin
  Result := not IsPM(AValue); // 不是下午即为上午 ^_^
end;

时间: 2024-08-08 11:57:54

System.DateUtils 3. IsPM、IsAM 判断是否为上、下午的相关文章

System.DateUtils 4. IsValidDateTime... 有效时间判断

编译版本:Delphi XE7 function IsValidDate(const AYear, AMonth, ADay: Word): Boolean;function IsValidTime(const AHour, AMinute, ASecond, AMilliSecond: Word): Boolean;function IsValidDateTime(const AYear, AMonth, ADay, AHour, AMinute, ASecond, AMilliSecond:

System.DateUtils Range checking functions部分函数示例及说明

该篇文章主要是对DelphiXE8的System.DateUtils单元中Range query functions部分的函数进行调用示例及说明,如有不对之处还望大家可以提出,本人予以改正! 本部分的函数都需要传入两个参数并且返回一个参数,分别是ANow:TDateTime类型,起始时间:AThen:TDateTime类型,截止时间:AParams: Integer或Int64类型,返回值(起始时间和截止时间的差). 该部分的函数达到的效果大致一样,都是传入起始时间和截止时间,返回两个时间的差,

System.DateUtils This of that functions部分函数示例及说明

该篇文章主要是对DelphiXE8的System.DateUtils单元中This of that functions部分的函数进行调用示例及说明,如有不对之处还望大家可以提出,本人予以改正! 其实之前对于DayOfTheWeek函数中的计算公式,为何要先对日期参数-1,然后再取模,最后对结果+1一直都没有理解,源码中的解释也不过是我通过测试得到的一个可能的结论而已.后来我在找参考资料的过程中发现了一段话,对我启发很大. 差不多所有星期算法的基础皆可归纳如下: 从一个已知的日子作为起始日,一般采

System.DateUtils Pick-a-field functions部分函数示例及说明

这个部分我们从定义上就可以理解它的作用,就是摘取某一区域,或者说叫选择某一段的值. 该部分分为两部分,提取日期部分的某一段,或者提取时间部分的某一段.日期部分本质上调用的是DecodeDateFully,具体实现代码在System.SysUtils第18705行;时间部分本质上调用的是DecodeTime,具体实现代码在System.SyUtils第18666行,有兴趣的朋友可以去这两个地方详细了解下! 下面是Pick-a-field functions部分函数示例及说明 代码示例

【HDU 4940】Destroy Transportation system(数据水/无源无汇带上下界可行流)

Description Tom is a commander, his task is destroying his enemy’s transportation system. Let’s represent his enemy’s transportation system as a simple directed graph G with n nodes and m edges. Each node is a city and each directed edge is a directe

System.DateUtils 2. IsInLeapYear 判断是否是闰年

编译版本:Delphi XE7 function IsInLeapYear(const AValue: TDateTime): Boolean; implementation // 判断是否是闰年 function IsInLeapYear(const AValue: TDateTime): Boolean;begin  Result := IsLeapYear(YearOf(AValue));end; // 是否是闰年,引用单元 System.SysUtils function IsLeapY

C# System.Windows.Forms.WebBrowser中判断浏览器内核和版本

参考 [完美]原生JS获取浏览器版本判断--支持Edge,IE,Chrome,Firefox,Opera,Safari,以及各种使用Chrome和IE混合内核的浏览器 利用js来判断 namespace WindowsFormsApp1 { public partial class Form1 : Form { public Form1() { InitializeComponent(); //webBrowser1.Navigate(@"C:\Users\admin\Desktop\test.

System.DateUtils 1. DateOf、TimeOf 简单修饰功能

编译版本:Delphi XE7 { Simple trimming functions } // 简单修饰功能 function DateOf(const AValue: TDateTime): TDateTime; inline; // 获取日期function TimeOf(const AValue: TDateTime): TDateTime; inline; // 获取时间 implementation function DateOf(const AValue: TDateTime):

如何用Jquery判断在键盘上敲的哪个按键

有时候我们需要判断我们在键盘上敲了哪个键,这个需要查询下键盘上的键对应的值是多少,比如Enter键是13. 下面是Jquery代码,别忘了引用Jquery包哈. <script type="text/javascript">        $(document).keypress(function (event) {            var keycode = (event.keyCode ? event.keyCode : event.which);