un-representable DateTime

c#, datetime

Solution

`new DateTime()` is `01/01/0001 00:00:00` which is also `DateTime.MinValue`.

You are subtracting one hour from that.

Guessing you are trying to subtract an hour from the `TimeTo` value:

var TimeFrom = TimeTo.AddHours(-1);

Problem

I have method which expects two datetime parameters ``` public void SomeReport(DateTime TimeFrom, DateTime TimeTo) { // ommited TimeFrom.ToString("ddMMyy"), TimeTo.ToString("ddMMyy"))); // ommited } ``` When I'm sending this params ``` DateTime TimeTo = DateTime.Now; DateTime TimeFrom = new DateTime().AddHours(-1); ``` This error occured: System.ArgumentOutOfRangeException : The added or subtracted value results in an un-representable DateTime. What can be the problem?

Original source