Getting date in .NET

  • Thread starter Thread starter Baz
  • Start date Start date
B

Baz

How can I get yesterday's date in a program? I tried using the following,
but it fails on the first day of the month

dtnow = new DateTime(Year, Month, Date-1);

Thanks for any help!
 
Baz said:
How can I get yesterday's date in a program? I tried using the following,
but it fails on the first day of the month

dtnow = new DateTime(Year, Month, Date-1);

Use AddDays(-1)

-- Alan
 
Back
Top