Description C ++ Date Format parameter description

Source: Internet
Author: User

C ++ date formatting in order to achieve different display effects, sometimes we need to convert the time. The default format is: 14:33:34. to convert it to another format, DateTime is used. the ToString method (String, IFormatProvider) is as follows:

 
 
  1. using System;   using System.Globalization;   String format="D";   
  2. DateTime date=DataTime,Now; 
  3.   Response.Write(date.ToString(  format, DateTimeFormatInfo.InvariantInfo));   

C ++ detailed format usage of the format parameter for date formatting: Description of format characters and associated attributes:

D: ShortDatePattern

D: LongDatePattern

F: complete date and long and short time)

F: FullDateTimePattern long date and long time)

G: regular short date and short time)

G: regular short date and long time)

M, M: MonthDayPattern

R, R: RFC1123Pattern

S: Use the local time of SortableDateTimePattern based on ISO 8601)

T: ShortTimePattern

T: LongTimePattern

U: UniversalSortableDateTimePattern used to display the format of common time

U: use the full date and long time of the general time)

Y, Y: YearMonthPattern

The brief introduction of the C ++ DateTime. ToString Method for date formatting will be introduced here. I hope the DateTime. ToString method that helps you understand and learn C # date formatting will be helpful.

  1. How to Write C ++ project development and project plan correctly
  2. Summary Notes on learning and exploring C ++ library functions
  3. In-depth demonstration of high security of C ++
  4. Describes in detail how to accurately Write C ++ languages.
  5. In-depth demonstration of high security of C ++

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.