During page initialization, JavaScript is used to format the date type read from the database to the desired type. Format it as yyyy MM mm dd hh mm mm ss seconds. You can refer to the following code for free use.
The Code is as follows:
// Input the date data retrieved from the database
Function getformatdate (d ){
Var formate_datetime;
Var array = d. split ("");
Var date = array [0];
Var time = array [1];
Var array_date = date. split ("-");
Var array_time = time. split (":");
Var second = array_time [2]. split (".") [0];
Formate_datetime = array_date [0] + "year" + removeZero (array_date [1]) + "month" + removeZero (array_date [2]) + "day"
+ RemoveZero (array_time [0]) + "Hour" + removeZero (array_time [1]) + "Minute" + second + "second ";
Return formate_datetime;
}
// Remove the value 0 before month, day, hour, and minute
Function removeZero (data)
{
If (data. charAt (0) = "0 "){
Return data. charAt (1 );
}
Else
{
Return data;
}
}