Last active
May 15, 2024 17:16
-
-
Save matthieua/86f954bdffc3f6d5d4081542eed13ac7 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="UTF-8" /> | |
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> | |
<meta http-equiv="X-UA-Compatible" content="ie=edge" /> | |
<script src="https://unpkg.com/axios/dist/axios.min.js"></script> | |
<title>Dates</title> | |
<style> | |
h1 { | |
color: #6443ea; | |
font-family: "PT Mono"; | |
text-align: center; | |
} | |
h2 { | |
font-weight: bold; | |
font-size: 24px; | |
text-align: center; | |
} | |
</style> | |
</head> | |
<body> | |
<h1>📅 Dates</h1> | |
<h2></h2> | |
<script> | |
let now = new Date(); | |
let h2 = document.querySelector("h2"); | |
let date = now.getDate(); | |
let hours = now.getHours(); | |
let minutes = now.getMinutes(); | |
let year = now.getFullYear(); | |
let days = ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"]; | |
let day = days[now.getDay()]; | |
let months = [ | |
"Jan", | |
"Feb", | |
"March", | |
"Apr", | |
"May", | |
"Jun", | |
"Jul", | |
"Aug", | |
"Sep", | |
"Oct", | |
"Nov", | |
"Dec" | |
]; | |
let month = months[now.getMonth()]; | |
h2.innerHTML = `${day} ${month} ${date}, ${hours}:${minutes}, ${year}`; | |
</script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment