What do you want to save?
Add Code snippet
New code examples
-
Other 2021-11-15 04:25:12
epoch
let unix_timestamp = 1605404179 // Create a new JavaScript Date object based on the timestamp // multiplied by 1000 so that the argument is in milliseconds, not seconds. var date = new Date(unix_timestamp * 1000); // Hours part from the timestamp var hour... Add solution -
Html 2021-11-04 12:15:13
how to make a clock in html/javascript
<!-- This is set automatically to your time zone --> <script> function showTime(){ var date = new Date(); var d = date.getDate(); var d1 = date.getDay(); var h = date.getHours(); // 0 - 23 var m = date.getMinutes();... Add solution -
Other 2021-09-07 05:34:02
does not conform to the required format. The format is "yyyy-MM-ddThh:mm" followed by optional ":ss" or ":ss.SSS".
export function toDatetimeLocal(){ const date = new Date(), ten = (i)=> ((i < 10 ? '0' : '') + i ), YYYY = date.getFullYear(), MTH = ten(date.getMonth() + 1), DAY = ten(date.getDate()), HH = ten(date.getHours()), MM... Add solution -
Javascript 2021-09-05 07:53:02
get time from server and run it from there in javascript
var serverTime = 1490856278000; var expected = serverTime; var date; var h; var m; var s; var now = performance.now(); var then = now; var dt = 0; var nextInterval = (interval = 1000); setTimeout(step, interval); ... Add solution -
Javascript 2021-09-04 07:36:02
typescript/JavaScript time ago from datetime
/** * A function that converts date object to human readable time ago * @param {Date} date * @returns {string} * @author [YogPanjarale](https://github.com/YogPanjarale) */ export function dateToTimeAgo(date: Date): string { const now = new Date(Dat... Add solution