One step later, the platform was changed to the year of China

Source: Internet
Author: User
At present, it is produced by using the gridview auto-generated directly through experience. All the information I want, the metadata name, and so on should be handled to the gridview first, the time is the most wordy, because every time the year of the People's Republic of China needs to call the method of the Year of the People's Republic of China, it takes a long time to think that, after a long time, I found a method to solve the problem.

To be honest, it is very simple, just to know the usage, in. net micro-engine is very eager to provide the foreign law of various countries, there is a TV station, as long as the change of the current online order of culture and the law can be

Thread. currentthread. currentculture = new cultureinfo ("ZH-tw ");
Thread. currentthread. currentculture. datetimeformat. Calendar = new taiwancalendar ();

Datetime. now. tostring () records are generated as YY/MM/DD upper (lower) noon hh: mm: SS, where YY records over 1911. The current time segment can be directly exported to the year of China, however, my guest is still not interested. He wants to spend the year YY mm DD, and of course I also want to find a way to continue Yongyi for a long time.

Check datetime in msdn. tostring () indicates that he is calling the label format g (generally the sorting date/time mode), but he cannot find how to set the g from msdn, in the end, I rely on reflector to reverse the datetime. tostring () is traced back and found. Internal string generallongtimepattern
{
Get
{
If (this. generallongtimepattern = NULL)
{
This. generallongtimepattern = This. extends datepattern + "" + this. longtimepattern;
}
Return this. generallongtimepattern;
}
}
 

Public String comment datepattern
{
Get
{
If (this. extends datepattern = NULL)
{
This. Required datepattern = This. getstringfromcalendartable (0x1, 0xe );
}
Return this. Required datepattern;
}
Set
{
This. verifywritable ();
If (value = NULL)
{
Throw new argumentnullexception ("shortdatepattern", environment. getresourcestring ("argumentnull_string "));
}
This. Required datepattern = value;
This. generallongtimepattern = NULL;
This. generalpolictimepattern = NULL;
}
}
 

 

When datepattern is set to generallongtimepattern = NULL, while generallongtimepattern = NULL, use this. When datepattern + "" + this. longtimepattern
Therefore, you can use the preset datepattern to meet your requirements.

As long as the following programs are available and can be used directly for the Year of the People's Republic of China.
Cultureinfo taiwanci = new cultureinfo ("ZH-tw ");
Taiwanci. datetimeformat. Calendar = new taiwancalendar ();
Taiwanci. datetimeformat. paidatepattern = "mm DD, YY ";

Sometimes I just want to tell how the date is written. If there is only one rule in a statement, we can

Taiwanci. datetimeformat. longtimepattern = "";

Is it a simple fire? I think I was so stupid and used a bunch of stupid methods.

However, there is a shortage of three errors (for example, 096) that cannot be found at the hour (do not set it to "0yy mm dd ", 100 is changed to 0100, and there will always be one more zero. We can compare it with another nine hundred years later.) We don't have this demand yet.

Cause: Because the Web is in the order of lines in each region, I only change the culture in "A" and "B, at the same time, only the and B regions will be changed to the civil year, but the B region will not have any influence. If you don't want to configure it in Globa

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.