Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

date to seconds js

var date = new Date("2015-08-25T15:35:58.000Z");
var seconds = date.getTime() / 1000; //1440516958
Comment

javascript seconds to date

let sec = 1628618888939
let time = new Date(sec)
let normalDate = new Date(sec).toLocaleString('en-GB',{timeZone:'UTC'})
time: "Tue Aug 10 2021 21:08:08 GMT+0300 (Eastern European Summer Time)"
normalDate: "10/08/2021, 18:08:08"
Comment

js seconds to time

const secs2Time = (secs) => {
  const hours = Math.floor(secs / 60 / 60).toString().padStart(2, 0)
  return hours + ':' + new Date(secs * 1000).toISOString().substr(14, 5)
}
Comment

PREVIOUS NEXT
Code Example
Javascript :: cheerio get href text 
Javascript :: jquery download image from url 
Javascript :: generate random hex 
Javascript :: Javascript find element with focus 
Javascript :: duplicate an array in javascript n times 
Javascript :: js date format mm/dd/yyyy 
Javascript :: trunc number javascript 
Javascript :: flatten in js without lodash 
Javascript :: connecting react to socket.io 
Javascript :: Iterate with JavaScript For Loops 
Javascript :: settime out with promise 
Javascript :: nuxt js if is client 
Javascript :: javascript replace doublequote with empty string 
Javascript :: lottie react 
Javascript :: falsy javascript 
Javascript :: go to top angular 
Javascript :: letter javascript regex 
Javascript :: javascript add hours 
Javascript :: vue js required props 
Javascript :: define array with custom index javascript 
Javascript :: how to detect which key is pressed in javascript 
Javascript :: how to find closest img tag in jquery 
Javascript :: add multiple class list at once in js 
Javascript :: button size react native 
Javascript :: array.filter async 
Javascript :: flutter access json object inside object 
Javascript :: throttling function in javascript 
Javascript :: string to ascii code js 
Javascript :: set focus on load javascript 
Javascript :: jquery has attribute 
ADD CONTENT
Topic
Content
Source link
Name
7+6 =