"how to convert the "time" from datetime into int?" Code Answer


first step is to convert string to datetime. use datetime.tryparse(string value, out datetime dt). then as mathew watson rightly suggested, get the value of variable dt converted to milliseconds using dt.timeofday.totalmilliseconds. it is also possible to convert the span in totalseconds or totalminutes if it suits your requirement. try to avoid calling tostring() method directly before checking if cell value is null. if i want to avoid the check, i would make compiler to do it by using something like : rows[3].cells[2].value + "" instead of value.tostring().

By Purgatory on March 28 2022

Answers related to “how to convert the "time" from datetime into int?”

Only authorized users can answer the Search term. Please sign in first, or register a free account.