System. ArgumentOutOfRangeException: Hour, Minute, and Second parameters describe an un-representable DateTime

edx
edx
88 Points
29 Posts

I'm trying to use following DateTime method:

var newDateTime = new DateTime(dateTime.Year, dateTime.Month,
             dateTime.Day, hour, minute, 0);

It's working majority times by some time getting error as:

System.ArgumentOutOfRangeException: Hour, Minute, and Second parameters describe an un-representable DateTime.
   at System.DateTime.TimeToTicks(Int32 hour, Int32 minute, Int32 second)

Anyone has any solution of this?

Views: 44
Total Answered: 1
Total Marked As Answer: 0
Posted On: 09-Feb-2021 02:55

Share:   fb twitter linkedin
Answers
Rahul Maurya
Rahul M...
Moderator
1252 Points
221 Posts
         

Please check hour and minute. It seems these getting out of range.

Posted On: 12-Feb-2021 08:06
 Log In to Chat