gpt4 book ai didi

datetime - Delphi:格式化日期时间,不带午夜时间部分

转载 作者:行者123 更新时间:2023-12-02 11:19:34 25 4
gpt4 key购买 nike

德尔福西雅图:

我想使用此规则(如 DateTimeToStr)格式化 cxGridDBTableView(Devexpress、cxGrid)中的日期时间字段:

  • 午夜 - 00:00:00 - 时间部分不可见
  • 其他时间 - 时间部分可见

我记得格式日期时间 HH:NN:SS 显示时间部分“每次”。

您知道模拟 DateTimeToStr 的选项吗?我想在存储库中使用它。

谢谢!

最佳答案

使用“c”作为字段的DisplayFormat。该文档说明了这一点:

The date using the format given by the ShortDateFormat global variable, followed by the time using the format given by the LongTimeFormat global variable. The time is not displayed if the fractional part of the DateTime value is zero.

关于datetime - Delphi:格式化日期时间,不带午夜时间部分,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56114538/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com