Answer the question
In order to leave comments, you need to log in
How to get date format from date string and time string?
Hello.
I have a google sheet. It has a date column ("dd.MM.yyyy") and a time column ("HH:mm:ss").
I did not change the format of these columns manually. Therefore, it remains the default. MOSCOW
time .
Tell me, please, how should a function look like that merges the date and time into a common date-time to be added to Google Calendar? Taking into account the Moscow time zone, of course.
Thank you!
Well, that is, the dateTimeStart (date and time) and dateTimeEnd (also date and time) options will go to the Calendar.
How to generate these dateTimeStart and dateTimeEnd?
Answer the question
In order to leave comments, you need to log in
let date = Utilities.formatDate(new Date(), "GMT+3", 'dd.MM.yyyy');
https://24timezones.com/chasovoy-poyas/gmt#gref
Dates and times in Spreadsheets are simply added together. The best thing in this situation is to have a column with the sum between "dd.MM.yyyy"
and "HH:mm:ss"
.
To get a valid Date object, it will be enough to take the value from the final cell.
const dateTimeStart = sheets.getRange('C1').getValue();
dateTimeEnd
- only you know, but in the end, the resulting one dateTimeStart
is suitable for passing as argument values to methods CalendarApp
.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question