String. Format formatted date format

Source: Internet
Author: User

DateTime dt = datetime.now;//2010 October 4 17:05
String str = "";
str = string. Format ("{0:y yy yyy yyyy}", DT); 10 10 2010 2010
str = String.Format ("{0:m MM MMM MMMM}", DT); 10 100 months October
str = String.Format ("{0:d dd ddd dddd}", DT); 4 04 Monday Monday
str = String.Format ("{0:h hh H hh}", DT); 5 05 17 17
str = String.Format ("{0:m mm}", DT); 8 08
str = String.Format ("{0:s ss}", DT); 3 03
str = String.Format ("{0:f ff FFF FFFF}", DT); 9 95 953 9530
str = String.Format ("{0:f FF FFF FFFF}", DT); 9 95 953 953
str = String.Format ("{0:t tt}", DT); Next afternoon
str = String.Format ("{0:z zz zzz}", DT); +8 +08 +08:00

str = String.Format ("{0:d/m/yyyy HH:mm:ss}", DT); 4-10-2010 17:16:50
str = String.Format ("{0:m/d/yyyy}", DT); 10-4-2010
str = String.Format ("{0:mm/dd/yyyy}", DT); 10-04-2010
str = String.Format ("{0:ddd, MMM D, yyyy}", DT); Monday, October 4, 2010
str = String.Format ("{0:dddd, MMMM D, yyyy}", DT); Monday, October 4, 2010
str = String.Format ("{0:mm/dd/yy}", DT); 10-04-10
str = String.Format ("{0:mm/dd/yyyy}", DT); 10-04-2010

str = String.Format ("{0:t}", DT); 17:29
str = String.Format ("{0:d}", DT); 2010-10-4
str = String.Format ("{0:t}", DT); 17:29:59
str = String.Format ("{0:d}", DT); October 4, 2010
str = String.Format ("{0:f}", DT); October 4, 2010 17:30
str = String.Format ("{0:f}", DT); October 4, 2010 17:31:11
str = String.Format ("{0:g}", DT); 2010-10-4 17:35
str = String.Format ("{0:g}", DT); 2010-10-4 17:36:18
str = String.Format ("{0:m}", DT); October 4
str = String.Format ("{0:y}", DT); October 2010
str = String.Format ("{0:r}", DT); Mon, Oct 17:37:25 GMT
str = String.Format ("{0:s}", DT); 2010-10-04t17:37:43
str = String.Format ("{0:u}", DT); 2010-10-04 17:38:01z

String. Format formatted date 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.