Let's see what happens when you try to create a DateTime as Nothing:
Dim dt As DateTime = Nothing
Console.WriteLine(dt.ToString("yyyy-MM-dd HH:mm:ss.fffffff"))
we get "0001-01-01 00:00:00.0000000". This is the earliest datetime that can be represented by a DateTime. It can't hold a "value" of Nothing
because it is a Value type: Why is null not allowed for DateTime in C#?.
Let's try adding 1 tick:
dt.Add(New TimeSpan(1))
Console.WriteLine(dt.ToString("yyyy-MM-dd HH:mm:ss.fffffff"))
Oh! We get "0001-01-01 00:00:00.0000000" again. The tick was not added on. That is because the Add
method returns a new DateTime - it does not affect the one that Add
was invoked on.
Let's try again:
dt = dt.Add(New TimeSpan(1))
Console.WriteLine(dt.ToString("yyyy-MM-dd HH:mm:ss.fffffff"))
Now we get "0001-01-01 00:00:00.0000001", as intended.
What happens if we try to go earlier than the first allowed DateTime?
Dim dt As DateTime = Nothing
dt = dt.Subtract(New TimeSpan(1))
It throws a System.ArgumentOutOfRangeException.