so, I have this google sheets from where, I need to generate some PDF, it's working fine, except the date. if I have selected the date as 29/12/2021 in my sheet, it appears as 28/12/2021 in the generated PDF. I don't what went wrong, I have tried changing the locale and time zone. but nothing came out as well. what's exactly the problem? and I wanted to know that, is there any way I can change this using apps-script?
Asked
Active
Viewed 54 times
0
-
Are you aware that there is a time zone setting for the script and the spreadsheet? – Cooper Dec 31 '21 at 06:59
-
In your situation, is this thread useful? https://stackoverflow.com/q/66194990 – Tanaike Dec 31 '21 at 07:05
-
@Tanaike ... where can I find the timezone in app script ? Thanks in advance for your answer. – Mike Steelson Dec 31 '21 at 10:42
-
1@Mike Steelson About your question of `where can I find the timezone in app script ?`, how about checking the manifest file `appsscript.json`? [Ref](https://developers.google.com/apps-script/concepts/manifests) When you see `appsscript.json`, you can see the current timezone by the property of `timeZone`. When the new IDE was released, this value had a bug. But this bug had been removed in April 2021. [Ref](https://issuetracker.google.com/issues/175718931) If this explanation was not useful, I apologize. – Tanaike Dec 31 '21 at 12:56
-
1Many Thx @Tanaike ... I really enjoy reading your posts and you write English very well, much better that I do (I am French). – Mike Steelson Dec 31 '21 at 13:35
-
@MikeSteelson App Script's time zone can be checked/changed by using the `Legacy editor` and clicking `File > Project properties > Time Zone` from the menu above the script editor. – Mr Shane Dec 31 '21 at 18:47
-
@Mike Steelson Thank you for replying. – Tanaike Jan 01 '22 at 00:40
1 Answers
1
The best and simpliest way is to use .getDisplayValue()
instead of .getValue()

Mike Steelson
- 14,650
- 2
- 5
- 20