datetime - Google Spread Sheet Script. Working with Dates -


i reading list of google sheet cells containing datetime, using google script. values in cells are:

a1: jul 26 13:00

a2: jul 27 0:00

var datevalues = spreadsheetapp.getactivesheet().getrange("a1:a2").getvalues();  

however, values read 1 hour behind. see in debugger:

datevalues[0] = wed jul 26 2017 12:00:00 gmt+0200 (eet)

datevalues[1] = wed jul 26 2017 23:00:00 gmt+0200 (eet)

i guess time zone issue, don't understand concept. time zone currently (due dts) gmt + 3. indeed, outside dts period gmt +2. spread sheet time zone jerusalem gmt+2.

eet - don't underrated why being used.

basically, expect in code values in sheet.

what concept?

there 2 ways solved this

  1. use getdisplayvalues() rather getvalues(). force conversions, getdisplayvalues() returns strings not dates

  2. make script editor time zone match sheet tz. in case sheet (gmt+2 jerusalem), script editor different (gmt+2 moscow) reason. setting script editor tz, solved problem.


Comments

Popular posts from this blog

Is there a better way to structure post methods in Class Based Views -

performance - Why is XCHG reg, reg a 3 micro-op instruction on modern Intel architectures? -

jquery - Responsive Navbar with Sub Navbar -