When you want to obtain formatted data, you can only obtain the value on "XXXX, XX, XX" in the value method. The solution for "week X" in the future is as follows, if you are interested, refer to the following code for a very strange problem today:
SimpleDateFormat dateFormat = new SimpleDa
The Code is as follows:
TeFormat ("MM dd, yyyy ");
String date = dateFormat. format (new Date ());
It is intended to print out the week X of XXXX Year XX month XX day
The problem lies in the following code. When I want to obtain formatted data, when the value = method value is used, I can only get "XXXX, XX, XX ", the next "week X" cannot be obtained
The Code is as follows:
Disabled/>
① Later I thought it could be an HTML Escape problem, so I removed all the spaces in "yyyy MM dd E, the result can be set to "yyyy-MM-dd-E"
② There is also a way to replace the content of the strings to be displayed one by one using escape characters.
The Code is as follows:
<%
String result = "";
For (int I = 0; I <date. length (); I ++ ){
Switch (date. charAt (I )){
Case '<':
Result + = "<";
Break;
Case '> ':
Result + = "> ";
Break;
Case '&':
Result + = "&";
Break;
Case '"':
Result + = "\"";
Break;
Case '\'':
Result + = "'";
Break;
Case '':
Result + = "";
Break;
Default:
Result + = date. charAt (I );
}
}
%>
The reference content is as follows::
HTML original code display result description
<Less than sign or display mark
> Greater than signs or display tags
& Can be used to display other special characters
"" Quotation marks
®®Registered
©©Copyright
™™Trademark
Half a blank space
A blank space
Blank rows