I need help like cider
Develop node.js, express as ejs template.
In express, render date data as ejs the variable 2016-08-14 12:03:44 of dateTime.
You want to convert the dateTime value received from ejs into a JavaScript function gapTime() that calculates how many minutes before the current time in html.
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title></title>
<script>
function gapTime(time) {
var result;
...
return result
}
</script>
</head>
<body>
<p>gapTime(<%= dateTime %>)</p>
</body>
</html>
Of course it doesn't work like this.
Is there any way?
javascript date html node.js ejs
It is convenient to communicate with a long value in utc format, not a formatted string, and format it when rendering on the client.
JS built-in functions are very troublesome to handle as they fly. Try the utility below.
© 2024 OneMinuteCode. All rights reserved.