String. format, datetime Date and Time Format collection

Source: Internet
Author: User

Datetime dt = datetime. Now; //, January 1, October 4, 2010
String STR = "";
// STR = string. Format ("{0: y yy yyy yyyy}", DT); // 10 10 2010 2010
// STR = string. Format ("{0: m mm mmm}", DT); // 10 May October 10
// STR = string. Format ("{0: d dd DDD dddd}", DT); // 4 04 Monday
// STR = string. Format ("{0: h hh}", DT); // 5 05 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, January 1, October 4, 2010
// STR = string. Format ("{0: dddd, Mmmm D, yyyy}", DT); // Monday, January 1, 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
// STR = string. Format ("{0: f}", DT); // October 4, 2010 17:31:11
// STR = string. Format ("{0: g}", DT ); //
// STR = string. Format ("{0: g}", DT); // 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, 04 Oct 2010 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
Response. Write (STR );

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.