- Trending Categories
- Data Structure
- Networking
- RDBMS
- Operating System
- Java
- MS Excel
- iOS
- HTML
- CSS
- Android
- Python
- C Programming
- C++
- C#
- MongoDB
- MySQL
- Javascript
- PHP
- Physics
- Chemistry
- Biology
- Mathematics
- English
- Economics
- Psychology
- Social Studies
- Fashion Studies
- Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Short Time ("t") Format Specifier in C#
The Short Time format specifier represents a custom date and time format string.
It is defined by the current DateTimeFormatInfo.ShortTimePattern property.
For example, the custom format string is −
HH:mm
Example
using System; using System.Globalization; class Demo { static void Main() { DateTime date = new DateTime(2018, 5, 4, 10, 12, 10); Console.WriteLine(date.ToString("t", CultureInfo.CreateSpecificCulture("en-us"))); } }
Output
10:12 AM
Advertisements