« first day (12 days earlier)      last day (908 days later) » 

9:41 AM
@Vidar he you here?
 
10:05 AM
@JacobJanTuinstra Hi!
 
@VidarS.Ramdal Did you see the code I made?
I think it works as well.
I saw you changed your avatar on G+
 
oh, now I do
yes, that code looks prettier
but I don't understand why you use Utilities.formatDate, instead of just returning the date?
 
apparently the OP wants to have a time notation.
 
ah, ok, that's what he wants
but anyway, couldn't we just format the cell to display time only?
 
yes, that's possible, but if you're using a script in the first place, that's then covered by the script....
 
10:13 AM
I haven't used formatDate before, but doesn't it just return a string? Would you be able to do calculations on the timestamps?
 
The newDate() returns milliseonds
the dateFormat, parses that to the correct format
 
I see, but the returned value of Utilities.formatDate is still a string, right? Or am I missing something?
 
I think yes, do a typeof to be sure.
 
Yeah, I just tried var time = Utilities.formatDate(new Date(), "GMT+1", "HH:mm:ss");
Logger.log(time + 1); and it seems to just append the 1
 
@VidarS.Ramdal It will be recognised though in the sheet
try Logger.log(typeof time)
 
10:18 AM
As in: it will be recognized as a timestamp? if so, that's cool
typeof time returns "string"
 
@VidarS.Ramdal I need to go.....@Alex Welcome and goodbye
 
user58869
@JacobJanTuinstra later
 
Me too, but while you're away, you could ponder on this question :) I wasn't aware that spreadsheet editors also could edit the script. Isn't that a security risk? If I let "anyone with the link" edit my spreadsheet, they can apparently also do anything to the script (like DDOSing something). What do you usually do, when you want to demonstrate something in a spreadsheet?
 
10:52 AM
@VidarS.Ramdal I face those problems as well. Nowadays I set the option to "view" rather then to "edit". People still can make a copy and explore the solution this way.....
 
Yeah, I'd better start doing that myself.
As to the improved code, would you like to post it as your answer, or should I edit mine?
 
Edit yours, and I will upvote !!
Don't mention me please
 
Oh, okay, I'll do
Great, Jacob Jan, thanks a lot for the upvote!
 

« first day (12 days earlier)      last day (908 days later) »