Dates in Indonesian
Apps Script recipes › Dates, text and numbers
"Selasa, 3 November 2026" and "03/11/2026 14:05" in the script's time zone.
File Code.gs
const HARI_ = ['Minggu', 'Senin', 'Selasa', 'Rabu', 'Kamis', 'Jumat', 'Sabtu'];
const BULAN_ = ['Januari', 'Februari', 'Maret', 'April', 'Mei', 'Juni', 'Juli', 'Agustus', 'September', 'Oktober', 'November', 'Desember'];
/** "Selasa, 3 November 2026" */
function tanggalPanjang_(date) {
const tz = Session.getScriptTimeZone();
const d = Number(Utilities.formatDate(date, tz, 'd'));
const m = Number(Utilities.formatDate(date, tz, 'M')) - 1;
const day = Number(Utilities.formatDate(date, tz, 'u')) % 7; // 1 = Monday … 7 = Sunday
return `${HARI_[day]}, ${d} ${BULAN_[m]} ${Utilities.formatDate(date, tz, 'yyyy')}`;
}
/** "03/11/2026 14:05" */
function tanggalJam_(date) {
return Utilities.formatDate(date, Session.getScriptTimeZone(), 'dd/MM/yyyy HH:mm');
}
Good to know
- Utilities.formatDate writes month and day names in English; this recipe names them itself.
- Set the time zone in appsscript.json ("timeZone": "Asia/Jakarta"), otherwise times can be off by hours.
Let the AI put it in your appGAS AI Builder knows every recipe here. Describe your app and it uses this code where it fits, in a Google Apps Script project in your own Drive.
Use it in a projectMore in Dates, text and numbers
Turn text from the page into a dateAn <input type="date"> sends "2026-11-03"; new Date() on it gives midnight UTC, a day early or late in some zones. This reads it in the script's time zone.Running numbers like INV-2026-0001A counter in Script Properties, raised under a lock so two people never get the same number; starts again each year.