Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

js datetime local

var date = new Date();
var dd = String(date.getDate()).padStart(2, '0');
var mm = String(date.getMonth() + 1).padStart(2, '0'); //January is 0!
var yyyy = date.getFullYear();

today = mm + '/' + dd + '/' + yyyy;
var time = date.toLocaleTimeString();

var dateTime = "Date: " + today + " and Time: " + time;
Comment

PREVIOUS NEXT
Code Example
Javascript :: npm for node types 
Javascript :: js inline if 
Javascript :: JsonConvert.DeserializeObject convert into dynamic datatable 
Javascript :: zoom in canvas javascript 
Javascript :: vue shortcut to create component 
Javascript :: nodejs request api 
Javascript :: js array copy not reference 
Javascript :: get days in current month using moment.js 
Javascript :: javascript find all occurrences in string 
Javascript :: sequelize include only 
Javascript :: hide a div when user clicks outside of it 
Javascript :: js invert color 
Javascript :: Uncaught TypeError: console.log is not a function 
Javascript :: angular elementref 
Javascript :: prop-types install npm 
Javascript :: get execution time in javascript 
Javascript :: javascript foreach index 
Javascript :: js listen for class change event 
Javascript :: redirect with javascript 
Javascript :: axios get error response message 
Javascript :: ecmascript 7 getmonth as 2 digits 
Javascript :: multiple value selected in select2 
Javascript :: javascript combine dictionaries 
Javascript :: rust read json file 
Javascript :: eject expo app to android and react native 
Javascript :: add element to array javascript 
Javascript :: react routes 
Javascript :: jquery select a dynamic element 
Javascript :: get date now javascript 
Javascript :: E: Unable to locate package npm 
ADD CONTENT
Topic
Content
Source link
Name
7+4 =