12 January 2015

Obscured by the cloud - why google hides functions in API docs ???

Just a quickie. I need to make a few Google Sheets scripts for some side projects, and struggle finding some basic low-level tools in Google API docs. For instance, you can't find String object documented....but it's still in there.

So I managed to successfully use function such as

toDateString
substring
indexOf

wondered why, and probable answer (not obvious to me) is that they are supported as a part of JavaScript which you can use in Google Script editor. Seems google just went so abstract in what they want developers to use form Google API services and apps that they dropped maintaining documentation for generic stuff like above. It causes some confusion, at least for me (I haven't been following any updates for devs from g's side).

Next time I will just remember.

Anyway, if you want to convert a cell contents which behind the scenes is stored by the sheet as:

Thu Dec 11 2014 01:00:00 GMT+0100 (CET)

to some more human readable form

use toDateString which yields

Mon Jan 12 2015

straight from JS: http://www.w3schools.com/jsref/jsref_todatestring.asp

or put his bit of code:

var month = data[row][col].getMonth() + 1;
var neatDate = data[row][col].getDate() + "/" + month +"/" + data[row][col].getFullYear();


good luck!




3 comments:

  1. Excellent information, for best It training's with placements
    websphere Online Training

    ReplyDelete
  2. This blog is nice and very informative. I like this blog. blog Please keep it up.

    ReplyDelete
  3. Informasi Lengkap Mengenai Cara Mengalahkan Bandar Sabung Ayam Online S1288

    Agen Sabung Ayam Online Terbaik Dan Juga Terpercaya https://sabungayamlive.net/

    Informasi Terlengkap Mengenai Sabung Ayam

    http://bvayamsate.blogspot.com/2018/09/bentuk-jalu-ayam-yang-mematikan-di.html/

    ReplyDelete