What I understood from your question is, you have some date time value in view state and you want to subtract it from current time.
var timespan = DateTime.Now.Subtract((DateTime)ViewState["DateTime"])
You must need to check the ViewState for null or valid date time value. Else you will get exception.
To know more about the DateTime
check here[
^]