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.
私は、人の月齢を考慮して生年月日を計算することに本当にこだわっています。現在、私はそれを行うためにC#を使用しています。しかし、ロジックを理解できませんでした。前もって感謝します
DateTime には、現在の日付から月を差し引く (実際には負の値を追加する) 完璧な方法があります。例えば:
int ageInMonths = 18; DateTime dt = DateTime.Today; DateTime DateOfBirth = dt.AddMonths(-ageInMonths);