Problem of generating XML with dataset in Asp.net

Source: Internet
Author: User

There are often characters in the format qualifier.
For example, in datetime. tostring CodeYear, M stands for month, etc.
What if I need these characters for the tostring result?
In this case, we need to use the escape character, and this escape mark is what we are familiar "\"

Datetime now = datetime. now;
Now. tostring ("YYYY, mm, dd hh: mm: ffff"); //, 06 3425

Now. tostring (@ "\ year: yyyy, \ mon \ t \ H: Mm, \ da \ Y: dd"); // year: 2006, month: 07, Day: 06

Sometimes we need to generate a path based on the current date. How does "\" represent it?

Datetime. Now. tostring (@ "YYYY \ mm \ dd \ hhmmffff. \ TX \ t"); // 2006 \ 07 \ 06 \ 14577812.txt

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.