Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function statistic() {
- let pendaftar = Sheet.from('Pendaftaran').getAll();
- let tabel = {}
- let baris =0;
- for(let i=0; i< pendaftar.length; i++){
- let tanggal = new Date (pendaftar[i][0]);
- let index = tanggal.getFullYear()+'-'+(tanggal.getMonth()+1)+'-'+('0'+tanggal.getDay()).substr(-2);
- if(tabel[index]){
- tabel[index]++;
- }else{
- tabel[index] = 1;
- baris++;
- }
- }
- let pesan = 'Jumlah Pendaftar berdaasrkan hari \n';
- for (index in tabel){
- pesan += 'Tanggal '+index+': '+tabel[index]+'\n';
- }
- return pesan;
- }
Advertisement
Add Comment
Please, Sign In to add comment