格式:Format_Date_Simple(byVal dt, byVal fmt)
参数:
dt:指定要处理的时间参数。
fmt:需要的格式
function Format_Date_Simple(byVal dt, byVal fmt)
Format_Date_Simple = fmt
Format_Date_Simple = replace(Format_Date_Simple, "yyyy", year(dt))
Format_Date_Simple = replace(Format_Date_Simple, "mm", right("00" & month(dt), 2))
Format_Date_Simple = replace(Format_Date_Simple, "dd", right("00" & day(dt), 2))
Format_Date_Simple = replace(Format_Date_Simple, "h", right("00" & hour(dt), 2))
Format_Date_Simple = replace(Format_Date_Simple, "n", right("00" & minute(dt), 2))
Format_Date_Simple = replace(Format_Date_Simple, "s", right("00" & second(dt), 2))
end function
应用:
dim generalDate
generalDate=now()
Response.write Format_Date_Simple(generalDate, "yyyy-mm-dd h:n:s")
返回:2020/10/07 12:06:10