About datetime time format conversion in. Net (original)

Source: Internet
Author: User
Tags time and date
In the development of. Net Applications Program When writing data to access, because access converts the data type of time and date, it is inconsistent with the format of Chinese year, month, and day, resulting in an application error. So I used this knowledge and found it online. Article

Coding best practices using datetime In the. NET Framework, on http://msdn2.microsoft.com/en-us/library/ms973825.aspx. The introduction should be comprehensive enough, but for general applications, you only need to set

System. datetime. Now. tostring ( " Yyyy-mm-dd hh: mm: SS " );

You can.

It's just a wake-up here. This can be done when the date and time format is applied, so there will be no problems. However, if you convert the specified format to the datetime format, the conversion problem also occurs. For example:

Datetime dt = Convert. todatetime ( " 2007-05-06 " );
// It translated it into 6.5. 2007

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.