Quantcast
Channel: Hot Weekly Questions - Web Applications Stack Exchange
Viewing all articles
Browse latest Browse all 9782

choose format for new Date() in Google Apps Script

$
0
0

I have tried almost all suggestions on the internet, yet nothing seems to work. Maybe someone can help a newbie out. I am using this at the end of my script:

sheet.appendRow([new Date(), null, text]);

and it works perfectly for my needs, but it shows the date in the format dd.MM.yyyy hh:mm:ss.

I,however, want it in the format dd.MM.yyyy. I am aware that I can choose the format within the sheet but that's just a way to display it differently and it messes up my =unique function later on.

I need a way to just enter the date without having to do any additional manipulations. I thought .setNumberFormat would be the way to go but this didn't work either: sheet.appendRow([cell.setValue(new Date()).setNumberFormat("dd.MM.yyyy"), text]);

What am I doing wrong? Any help will be greatly appreciated!


Viewing all articles
Browse latest Browse all 9782

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>