output month as text js
by grant
HTML
<div>
<div id="demo">something</div>
<div id="other">other</div>
<div id="another">another</div>
</div>
CSS
#demo {
display:inline-block;
// margin: 5px 5px 5px 25px;
// border-style: solid;
font-size: 20px;
font-family: Georgia, "Times New Roman",
Times, serif;
// color: purple;
// background-color: #d8da3d ;
}
#other {
display:inline-block;
// text-align: center;
font-size: 20px;
}
#another {
// display:inline-block;
// text-align: center;
font-size: 20px;
}
JavaScript
var monthNames = ["Jan", "Feb", "March", "April", "May", "June",
"July", "August", "September", "October", "November", "December"
];
var mth = new Date();
document.getElementById("demo").innerHTML = monthNames[mth.getMonth()];
let today = new Date();
let dd = today.getDate();
let mm = today.getMonth()+1; //January is 0!
let yyyy = today.getFullYear();
let hh = today.getHours();
let mmm = today.getMinutes();
if(dd<10) {
dd = '0'+dd
}
if(mm<10) {
mm = '0'+mm
}
if(hh<10) {
hh = '0'+hh
}
if(mmm<10) {
mmm = '0'+mmm
}
today = yyyy + mm + dd + hh + mmm;
let end = (today);
document.getElementById("another").innerHTML = end;
var number = 5;
document.getElementById("other").innerHTML = number;