Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

add seconds to date

var dbDate = '2013-11-15 12:51:18';
var seconds = 30;


var parsedDate = new Date(Date.parse(dbDate))
var newDate = new Date(parsedDate.getTime() + (1000 * seconds))


console.log(formatDate(newDate))


function formatDate(date){
    return ('{0}-{1}-{3} {4}:{5}:{6}').replace('{0}', date.getFullYear()).replace('{1}', date.getMonth() + 1).replace('{3}', date.getDate()).replace('{4}', date.getHours()).replace('{5}', date.getMinutes()).replace('{6}', date.getSeconds())
}
Comment

PREVIOUS NEXT
Code Example
Javascript :: javascript reducers 
Javascript :: how to convert python code to javascript 
Javascript :: convert c# code to javascript 
Javascript :: get selected data items kendo grid 
Javascript :: javascript number reverse 
Javascript :: react tutorial app 
Javascript :: regex country code 
Javascript :: regexp object 
Javascript :: character length jquery 
Javascript :: dom traversal jquery 
Javascript :: moment now 
Javascript :: math.ceil node js 
Javascript :: moment format dates 
Javascript :: prevent page scrolling when a modal is open 
Javascript :: sweetalert2 redirect after ok 
Javascript :: Pause the stream returned by getUserMedia 
Javascript :: pimcore 
Javascript :: hex color js 
Javascript :: javascript Implicit Boolean Conversion to Number 
Javascript :: javascript + Operator with Numbers 
Javascript :: javascript Nested Destructuring Assignment 
Javascript :: javascript statements 
Javascript :: set up express server and scraper 
Javascript :: javascript process.env.key with  
Javascript :: javascript döngü dizisi 
Javascript :: phaser random circle 
Javascript :: phaser animation yoyo 
Javascript :: npm deploy next js with tailwind 
Javascript :: react three fiber cannon collision 
Javascript :: Assign A New Method To Every Node 
ADD CONTENT
Topic
Content
Source link
Name
4+9 =