0

重複の可能性:
2つのTDateTime変数をチェックしています

2つの日付の差を計算して、差を表示するのに問題があります。以前の質問を投稿しました。

私はreplaceTime関数の助けを求めています。これをどのように/なぜ使用する必要があるのか​​わかりません。

これが私のコードです:

TDateTime testFirstDate("11/09/2012");
TDateTime testFirstTime("14:00");

TDateTime testSecondDate("12/09/2012");
TDateTime testSecondTime("16:00");

TDateTime testCombined1 = ReplaceTime(testFirstDate,testFirstTime);
TDateTime testCombined2 = ReplaceTime(testSecondDate,testSecondTime);

TDateTime testDateDifference = testCombined2 - testCombined1;

std::cout << testDateDifference;
4

1 に答える 1

0

あなたのコードは意味がありません。2つの日付の違いは決して新しい日付ではありません!

この部分は間違っていると思います:

TDateTime testDateDifference = testCombined2 - testCombined1;

2つの日付の違いは、期間、つまり期間(通常は秒単位)です。TDateTimeの実装を自分で作成しましたか?

于 2012-09-12T14:58:34.050 に答える