Code here :-
string CurrentTime = String.Format("{00:t}", DateTime.Now);
OutPut Something like this :- 9:45 AM
how can get time value something like this :- 09:45 AM
please let me know how to get this Time format :- 09:45 AM
please let me know how to get this Time format :- 09:45 AM
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Shakti Singh DulawatPosted Apr 26, 2016, 9:44 AM
DateTime.ToString() Patterns
All the patterns:
The patterns for DateTime.ToString ( 'd' ) :
The patterns for DateTime.ToString ( 'D' ) :
The patterns for DateTime.ToString ( 'f' ) :
The patterns for DateTime.ToString ( 'F' ) :
The patterns for DateTime.ToString ( 'g' ) :
The patterns for DateTime.ToString ( 'G' ) :
The patterns for DateTime.ToString ( 'm' ) :
The patterns for DateTime.ToString ( 'r' ) :
The patterns for DateTime.ToString ( 's' ) :
The patterns for DateTime.ToString ( 'u' ) :
The patterns for DateTime.ToString ( 'U' ) :
The patterns for DateTime.ToString ( 'y' ) :
Building a custom DateTime.ToString Patterns
The following details the meaning of each pattern character. Note the K and z character.
||\c || Represents the escape character, and displays the character "c" as a literal when that character is preceded by the escape character (\). To insert the backslash character itself in the result string, the application should use two escape characters ("\\").
Any other character copies any other character to the result string, without affecting formatting. ||