输入字段中时间戳的显示日期仅使用IST.结果应在javascript中的p标记中



输入字段中时间戳的显示日期仅使用IST结果应在p标记中(例如:1382086394000的时间戳必须有输出-->7月29日星期二45766 12:43:20 GMT+0530(印度标准时间(

function showDate(){
//Start Your code here


}
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Static Template</title>
</head>
<body>
<label for='tstamp'>TimeStamp</label><input type='text' id='in1' name='tstamp' oninput='showDate()'> <p id='result'></p> </body>
</html>

使用Javascript日期函数

function showDate(){
//Start Your code here
const timestampEntered = Number(event.currentTarget.value);
result.textContent = new Date(timestampEntered).toString();

}
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Static Template</title>
</head>
<body>
<label for='tstamp'>TimeStamp</label><input type='text' id='in1' name='tstamp' oninput='showDate()'> <p id='result'></p> </body>
</html>

最新更新