zoukankan      html  css  js  c++  java
  • 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;

  • 相关阅读:
    编程学习杂烩
    设计模式
    redis
    H5
    Java
    db工具
    python + pip
    mysql
    Spring Security
    Spring Cloud Gateway
  • 原文地址:https://www.cnblogs.com/BlackList-Sakura/p/4759957.html
Copyright © 2011-2022 走看看