【问题标题】:How to replace Day of TDateTime type on runtime如何在运行时替换 TDateTime 类型的 Day
【发布时间】:2013-02-04 03:20:52
【问题描述】:

我有一个名为 dtBegin 的 TDateTime 变量。 dtBegin 包含值“7/3/2000”。 我只需要将 Day 替换为“2”即可将值更改为“2/3/2000”。

如何做到这一点?有人建议我在 C++ Builder XE 中使用 RecodeDay() 方法,但该方法不起作用。我把 dtBegin 放在方法上:

RecodeDay(dtBegin, 2);

但是该方法没有返回我想要的值。

有什么方法可以做到这一点吗?请帮帮我。 提前致谢。

【问题讨论】:

    标签: c++builder-xe tdatetime


    【解决方案1】:

    RecodeDay是一个声明为System::TDateTime __fastcall RecodeDay(const System::TDateTime AValue, const System::Word ADay);的函数,所以需要存储返回值:

    dtBegin = RecodeDay(dtBegin, 2);
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2010-09-23
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-07-05
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多