How to getValues() with Google Script from Sheets so the date values matches
How to getValues() with Google Script from Sheets so the date values matches
I have a range of cells which contain dates in the following format:
7/27/2018 17:03:46
When I use:
var range = spreadsheet.getRange(1, 1, 20).getValues();
Logger.log(range[1][0]);
I get
Sat Jul 28 02:03:46 GMT+02:00 2018
instead of
7/27/2018 17:03:46
How do I get the correct value?
My Timezone is GMT +02:00
I've tried using new Date().
The link below will take you to the Spreadsheet:
https://docs.google.com/spreadsheets/d/1H7MAEfr0QbFuNwA8N_bm-08f_Phs8G2NNOQDYG-IA4E/edit?usp=sharing
getDisplayValues()
getValues()
var range = spreadsheet.getRange(1, 1, 20).getDisplayValues();
By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.
How about using
getDisplayValues()
instead ofgetValues()
likevar range = spreadsheet.getRange(1, 1, 20).getDisplayValues();
? By this, the displayed values can be retrieved. The document is here. If this was not useful for your situation, I'm sorry.– Tanaike
14 mins ago