javascript date get current date
var today = new Date();
var time = today.getHours() + ":" + today.getMinutes() + ":" + today.getSeconds();
var today = new Date();
var date = today.getFullYear()+'-'+(today.getMonth()+1)+'-'+today.getDate();
//var time = today.getHours() + ":" + today.getMinutes() + ":" + today.getSeconds();
var dateTime = date+' '+time;
The dateTime variable contains result as:
2018-8-3 //11:12:40var today = new Date();
var dd = String(today.getDate()).padStart(2, '0');
var mm = String(today.getMonth() + 1).padStart(2, '0'); //January is 0!
var yyyy = today.getFullYear();
today = mm + '/' + dd + '/' + yyyy;
document.write(today);
Also in JavaScript:
- js add item to array
- object object javascript
- DECIMAL TO BINARY CONVERSION javascript
- javascript keep scroll visible
- apollo server build schema passing parameters to classes
- jquery is checked
- react JSON data to display in a table
- Uncaught Error: spawn node C:\Users\Leonl\Desktop\rpi-nano-server\electron\express\server.js ENOENT electron
- angular material multi select ngmodel
- sequelize and
- jquery redirect to url
- html working with JSON data
- how to handle ajax calls in selenium
- glitch node version
- jquery change selected option to first
- dynamodb get all items nodejs
- javascript unique array of objects by property
- how to make an if statement in javascript
- airtable axios
- clear timeout js
- state in react
- pull out only text from element javascript
- jquery loop through list element
- remove accesnt and simbols and paranthesis from text js