You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I want to be able to seamless work with date/time cells without depending on knowing the spreadsheet locale or the cell format. While researching, I found out that Google Spreadsheets use date/times in serial format:
Google Sheets, like most other spreadsheet applications, treats date/time values as decimal values. This lets you perform arithmetic on them in formulas, so you can increment days or weeks, add or subtract two date/times, and perform other similar operations.
Google Sheets uses a form of epoch date that is commonly used in spreadsheets. The whole number portion of the value (left of the decimal) counts the days since December 30th 1899. The fractional portion (right of the decimal) counts the time as a fraction of one day. For example, January 1st 1900 at noon would be 2.5, 2 because it's two days after December 30th, 1899, and .5 because noon is half a day. February 1st 1900 at 3pm would be 33.625.
For reading: using Worksheet#numeric_value is enough (#377 also makes this more intuitive)
For writing: I did not find a way to write a numeric value to a date/time cell and had it to write a date. Because the Worksheet#[]= method calls stringifies the value, it is always interpreted as a number literal, instead of a serial number date. (opened #379 with a proposed solution)
The text was updated successfully, but these errors were encountered:
I want to be able to seamless work with date/time cells without depending on knowing the spreadsheet locale or the cell format. While researching, I found out that Google Spreadsheets use date/times in serial format:
https://developers.google.com/sheets/api/guides/concepts#datetime_serial_numbers
I would like to use it, so I had a look into it:
For reading: using
Worksheet#numeric_value
is enough (#377 also makes this more intuitive)For writing: I did not find a way to write a numeric value to a date/time cell and had it to write a date. Because the
Worksheet#[]=
method calls stringifies the value, it is always interpreted as a number literal, instead of a serial number date. (opened #379 with a proposed solution)The text was updated successfully, but these errors were encountered: