Answers for "javascript date format dd mm yyyy hh mm ss"

13

javascript date today dd mm yyyy

var 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);
Posted by: Guest on February-27-2020
3

java script print date in YYYY-MM-DD HH:MM:SS format

let date_ob = new Date();

// adjust 0 before single digit date
let date = ("0" + date_ob.getDate()).slice(-2);

// current month
let month = ("0" + (date_ob.getMonth() + 1)).slice(-2);

// current year
let year = date_ob.getFullYear();

// current hours
let hours = date_ob.getHours();

// current minutes
let minutes = date_ob.getMinutes();

// current seconds
let seconds = date_ob.getSeconds();

// prints date & time in YYYY-MM-DD HH:MM:SS format
console.log(year + "-" + month + "-" + date + " " + hours + ":" + minutes + ":" + seconds);
Posted by: Guest on March-02-2020
2

convert date format from yyyy-mm-dd to dd-mm-yyyy using value javascript

date.value.split("-").reverse().join("-");      //"2021-01-17" --> 17-01-2021
Posted by: Guest on January-17-2021
0

How to get current formatted date dd/mm/yyyy in Javascript

<input type="hidden" id="date"/>
<script>document.getElementById("date").value = new Date().toJSON().slice(0,10)</script>
Posted by: Guest on August-31-2021

Code answers related to "javascript date format dd mm yyyy hh mm ss"

Code answers related to "Javascript"

Browse Popular Code Answers by Language