I think that when you say that you add seconds, you mean when you try to read this by reading also seconds, you want to do something like
DateTime parsedDateTime = DateTime.ParseExact(startTime, "MM/DD/YYYY hh:mmtt", null); string dateTime = parseDateTime.ToString("MM/DD/YYY hh:mmtt");
The DateTime class always has seconds, milliseconds, and nanoseconds, which I think are stored in it. Always, if you fill them out or not, this assumes, although you just need to format how you read the information from the DateTime object so as not to give you pieces of DateTime data that you did not fill out or use.
If you store it in a database, understand that the database will also store all this information, whether you transfer it or not. There are different types of SQL DateTime, such as SmallDate, etc., which store different amounts of DateTime data, do not know if there is one that is stored for an hour, not a second, but with SQL you can also format the way that you select the data or just select it in your C # as a C # DateTime object, and then when you present it again, format ToString () so that it does not display the data you don't want / have.
source share