Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
2 つの日付ピッカー dtpFromDate と dtpToDate を含むウィンドウがあります。ユーザーが選択した日付から選択した月の最初の日付を選択し、日付までが同じ月の最後の日付であることを確認する方法を知りたいです。
あなたの説明から、あなたのニーズには月のドロップダウンで十分なはずです(ただし、年のドロップダウンも必要な場合があります)。
その情報から最初と最後の日付を簡単に作成できます。
var fromDate = new DateTime(theYear, theMonth, 1); var toDate = fromDate.AddMonths(1).AddDays(-1);