Skip to content

Instantly share code, notes, and snippets.

@dyazincahya
Created March 11, 2021 00:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dyazincahya/04c26c4d375e3b301e5f3df77c70f4ba to your computer and use it in GitHub Desktop.
Save dyazincahya/04c26c4d375e3b301e5f3df77c70f4ba to your computer and use it in GitHub Desktop.
Get current date and time in Javascript (Bahasa indonesia)
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