views:

21

answers:

0

Hi

I have created a Google Spreadsheet form in which for one of the fields I get the time (hh:mm:ss) in 24-hour format.

I am using Google Apps Scripts to read values from this spreadsheet and put it into another file. But the other file gets the entire date (don't know from where) and shows a date from 1899. Also the time is shown in PDT (not my time zone). Even the time it prints is not correct

How do I

  1. read the column value as a string and put it in the other file OR
  2. get just the time from the column value (and the correct time)

I am using a simple row[0][3] to get the values from an array after doing range.getValues()

Thanks.

More details
I am facing issues with getting the data in a different time zone. The time entered in a cell is 17:30:00. I am trying to convert it into a GMT+5 timezone. The date from the cell is read as Dec 30 1899 03:36:40 GMT-0800 (PST).

  1. I don't understand where it got the Dec 30 1899 part from (I don't mention the date anywhere in the cell. The cell only has 17:30:00 written in it)
  2. How does it get the value as 03:36:40?. This time is 14 hours behind (or 10:06 hours ahead) of the time in the cell. What does it consider as the timezone of the cell's value when converting into PST?
  3. At present there is daylight saving time. So why does it still get the values in PST and not PDT?

Also if I were to calculate the time in GMT-5:30 hours, how would I write the format statement? Tried

Utilities.formatDate(rowValues[0][10], "GMT-5:30", "HH:mm:ss");
Utilities.formatDate(rowValues[0][10], "GMT-0530", "HH:mm:ss");
Utilities.formatDate(rowValues[0][10], "GMT-5.5", "HH:mm:ss");

but it doesn't seem to work for any of these and I can't find any other help for what goes into the 2nd param for half hour delays.

Thanks again.