Remember one time due to Chinese and Japanese WIN7 system date comparison omission causes a program error

Source: Internet
Author: User

First write, not familiar with the use of methods, remember a small problem encountered in this study blog editing methods--

Part of the development of the day, the use of FarPoint.Win.Spread-related pay control, and then Japanese virtual machine Snapshot (Why do this-everyone knows it).

Since the whole project (vb.net c/s) was originally defined in Japan, it was developed in Japanese. But one day to use in the domestic sales, that is, the start of debugging and other work.

However, from the Japanese language under the Chinese version of the program will appear, most of the pages in the program spread report can not load data!

So I began to fill the pit of the former.

At first, some reason can not be compiled directly under the Chinese WIN7 (later resolved), can only be analyzed under the Japanese WIN7.

The spread control itself is excluded from the problem, the file encoding (mostly ANSI under Japanese system), code logic issues, and so on. Finally found

There is a way in the system

1     Private FunctionColumntodate (ByValStdate as String) as Integer2          forC as Integer= Columnenum.week toSh. ColumnCount-13             IfColumndate (c) = Stdate Then4                 ReturnC5             End If6         Next7         Return-18     End Function

Columndate (c) Returns the date of a string.

Stdata is also a string of dates. So in order to facilitate the direct use of DateTime.Now.ToString () the default format (not to say this time, the focus is the format, the same below), this is not a problem in Japanese.

But the output of DateTime.Now.ToString () in Chinese is "2015-4-28 16:36:55" and the Japanese Win7 is "2015-04-28 16:36:55".

Here's the problem. Chinese Win7 no 0!!!! This problem causes the spread report in most pages of the program not to load the data!

Therefore, it is recommended that you specify the format (example YYYYMMDDHHMMSS) If you must use a string to compare dates.

Welcome to make a variety of valuable comments.

Remember one time due to Chinese and Japanese WIN7 system date comparison omission causes a program error

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.