You can get the desired result with the code below. Two ‘H’ in HH
is for 24-hour format.
return fechaHora.Value.ToString("HH:mm");
More Related Contents:
- Converting a String to DateTime
- How can I convert a Unix timestamp to DateTime and vice versa?
- How to Query an NTP Server using C#?
- Parse DateTime with time zone of form PST/CEST/UTC/etc
- Algorithm to detect overlapping periods [duplicate]
- How to remove time portion of date in C# in DateTime object only?
- Unit Testing: DateTime.Now
- How can I round up the time to the nearest X minutes?
- How to get difference between two dates in Year/Month/Week/Day?
- DateTime “null” value
- How do I get the last day of a month?
- Measuring code execution time
- Display only date and no time
- What is the easiest way to subtract time in C#?
- DateTime.TryParse century control C#
- A type for Date only in C# – why is there no Date type?
- DateTime ToString issue with formatting months with “mm” specifier
- Count number of Mondays in a given date range
- How can I format DateTime to web UTC format?
- Check if datetime instance falls in between other two datetime objects
- Format date in C#
- How do I perform Date Comparison in EF query?
- Convert String to Date in .NET if my incoming date format is in YYYYMMDD
- DateTime conversion from string C#
- How to initialize a DateTime field?
- DateTime “null” / uninitialized value?
- Getting the first and last day of a month, using a given DateTime object
- Convert Date from Persian to Gregorian
- Unix time conversions in C# [duplicate]
- Datetime format Issue: String was not recognized as a valid DateTime