Created
March 11, 2021 00:02
-
-
Save dyazincahya/04c26c4d375e3b301e5f3df77c70f4ba to your computer and use it in GitHub Desktop.
Get current date and time in Javascript (Bahasa indonesia)
This file contains 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
var d = new Date(); | |
var p = d.getFullYear(), | |
q = d.getMonth()+1, | |
r = d.getDate(), | |
s = d.getHours(), | |
t = d.getMinutes(), | |
u = d.getSeconds(); | |
var months = ["Januari", "Februari", "Maret", "April", "Mei", "Juni", "Juli", "Agustus", "September", "Oktober", "November", "Desember"], | |
monthName = months[d.getMonth()]; | |
var days = ["Minggu", "Senin", "Selasa", "Rabu", "Kamis", "Jum'at", "Sabtu"], | |
dayName = days[d.getDay()]; | |
var result = dayName + ", " + r+"/"+monthName+"/"+p+" "+s+":"+t+":"+u; | |
// HASIL KETIKA KODE INI DIJALANKAN | |
// "Kamis, 11/Maret/2021 7:1:45" | |
console.log(result); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment