user1592380
user1592380

Reputation: 36205

Apps script formatDate has wrong time

enter image description here

I'm working with apps script. In my code I have:

var date =Utilities.formatDate(new Date(), "EST", "yyyy-MM-dd HH:mm:ss");
var now = Date.now();

I'm in the eastern time zone. I ran the function containing the lines above 1 minute ago. As you can see in the screenshot in the lower right corner the actual time and the time in the editor differ by an hour . What am I doing wrong?

Upvotes: 1

Views: 1184

Answers (1)

Jonatas Grandini
Jonatas Grandini

Reputation: 351

As mentioned by Cooper, you probably have a wrong time zone. Take a look in your project properties. Try checking the time zone in your spreadsheet too.

enter image description here

If that doesn't work, try also changing project time zone to a different one and changing it back to your correct time zone.

Upvotes: 2

Related Questions