Today, I want to make a report to capture the data obtained from the Web page. When the date is extracted, a problem occurs and I find that the time is automatically extracted by the program, inexplicably, there will always be an extra space, and I don't know what the cause is, but it doesn't affect the data, but it's strange, so I want to sort out the extracted time, no way to do it manually. Write a small program!
The requirement is very simple. I extracted the characters such as "" into the time format recognized in excel, so I started to do it, but the problem followed.
In the past, the Caption: = FormatDateTime ('yyyy-mm-dd', Now) was used when the time was often converted to the character creation );, therefore, it is assumed that the time format "yyyy-mm-dd" can be converted to a date or number, and the cell format can be set in excel, so converting to a number is also feasible, however, when StrToDate ('1970-09-12 ') is used, the report says it is not time, and it is really depressing. So I searched the internet and there is no problem, A lot of people on the Internet say they want to do this. I am a little confused, but suddenly I have an idea to see its default time format and use Caption.
: = DateTimeToStr (Now); The result shows that the running result is "12:00:56, the original time format is 'yyyy/mm/dd' instead of 'yyyy-mm-dd'. It is no wonder that 'yyyy-mm-dd' cannot be converted in excel, this is the problem !, So I tried StrToDate ('2014/1/12'). It was successful.
However, why do internet users say that StrToDate ('2017-09-12 ') is feasible? I suddenly remembered that there seemed to be related instructions in win7, saying that the time format was modified. I checked the time format and then I checked the materials I just read. In addition, previously, when the company called the windows form, there was also a difference between "termination" and "stop". I did not expect that the time was limited today.
However, there are many articles on the Internet that describe how to modify the time format, for example:
Under win7, although we changed the time date format in the control panel to YYYY-MM-DD, but the date obtained by the ASP function now () or date () is still in the/format. We can solve this problem by changing the registry:
Open the registry, go to [HKEY_USERS \. Default \ Control Panel \ international], and then
1. Change the sdate value from/-
2. Change the sshortdate value from yyyy/M/d to yyyy-m-D.
3. Restart IIS.