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.
618 Uncaught (inpromise) Error on Electron: An object could not be cloned
611 GDB gets version error when attempting to debug with the Presense SDK (IDE)
572 rails db:create error: Could not find mysql2-0.5.4 in any of the sources
914 When building Fast API+Uvicorn environment with PyInstaller, console=False results in an error
574 Who developed the "avformat-59.dll" that comes with FFmpeg?
© 2024 OneMinuteCode. All rights reserved.