C # custom time display format

Source: Internet
Author: User

 

String time = system. datetime. Now. tostring ("yyyy-mm-dd hh: mm: SS ");

 

Below are some common date and time display formats

 

Standard format
D mm/DD/YYYY, for example (2001-3-27)
D dddd, Mmmm DD, and YYYY, for example, March 27, 2001)
F dddd, Mmmm DD, yyyy hh: mm for example (March 27, 2001)
F dddd, Mmmm DD, yyyy hh: mm: SS for example (March 27, 2001 0:00:00)
G mm/DD/YYYY hh: mm for example)
G mm/DD/YYYY hh: mm: SS (0:00:00)
M, M mmmm dd (May March 27)
R, r ddd, DD Mmm yyyy HH ': 'mm': 'ss' gmt' such as (Mon, 26 mar 2001 16:00:00 GMT)
S yyyy-mm-dd hh: mm: SS does not seem to be available
T hh: mm (0: 00)
T hh: mm: SS (0:00:00)
U yyyy-mm-dd hh: mm: SS for example (2001-03-26 16: 00: 00Z)
U dddd, Mmmm DD, yyyy hh: mm: SS (March 26, 2001 16:00:00)
Y, y Mmmm, and YYYY, for example, March 2001)
 
Custom format List format Pattern description
D. Example: 2001-3-27
Dd example: 27
Ddd For example: Monday
Dddd For example: Monday (full name)
M. Example: January 1, March 27
MM example: 03
Mmm, for example, may March
Mmmm For example: July 22, March (full name)
Y, for example, January 1, March 2001
YY For example: 01
Yyyy For example: 2001
Gg For example: A.D.
HH, HH * e. g.: 12
HH, HH * e. g.: 00
M. Example: January 1, March 27
Mm, mm * e. g.: 00 (minutes)
S: 2001-03-27t00: 00: 00
SS, SS * such as: 00 (seconds)
T, for example, 0: 00
TT, TT * such as: Morning

C # custom time display format

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.