Converting time, so can create link to add to calendar - google-sheets

I would like to know How can I convert a given time into a proper time, so we can create a link which will generate event with just one click!
Example
We want to add a calendar event (sample like can be found here)
Title: Interview with Mark Zuckerberg
Location: google meet link
Start: 06/08/2022 # 04:00 PM
End: 06/08/2022 # 04:45 PM
Description: Meeting Details here
Now when we put the above details in the tool mentioned above, it generates a link, there we can simply replace the get variables and it becomes dynamic(just like we do using programming)
Add to calendar link generated by the tool
Problem
Not able to convert this
06/08/2022 04:00 PM to 06/08/2022 04:45 PM into 20220806T103000Z/20220806T111500Z
Pointers
Have to add time in that format only(04:45 PM) because non tech people will also use it
Can we generate automatic end time(based on some calculation, like each meeting will last 45 minutes, so we can avoid that calculation
We Use this feature in bulk, that is why add to calendar link generation is important for us

Option 01 - One formula one cell one click!
Use this formula
=ArrayFormula(IF(F2:F="",,HYPERLINK("https://calendar.google.com/calendar/u/0/r/eventedit?dates="&IF(F2:F="",,SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(TEXT(D2:D, "dd/mm/yyyy HH:MM:SS"),"/",""),":",""), " ","T")&"Z"&"/"&SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(TEXT(E2:E, "dd/mm/yyyy HH:MM:SS"),"/",""),":",""), " ","T")&"Z")&"&details="&ENCODEURL( C2:C)&"&location="&ENCODEURL( B2:B)&"&text="&ENCODEURL( A2:A),"Calendar Link")))
Let's check links
Option 02 - Multiple Steps
Use this formula to get the time formatted
With this formula you need to input Start time and duration only.
=ArrayFormula(IF(F2:F="",,SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(TEXT(D2:D, "dd/mm/yyyy HH:MM:SS"),"/",""),":",""), " ","T")&"Z"&"/"&SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(TEXT(E2:E, "dd/mm/yyyy HH:MM:SS"),"/",""),":",""), " ","T")&"Z"))
To Get the Link for calendars use this formula
=ArrayFormula(IF(F2:F="",,"https://calendar.google.com/calendar/u/0/r/eventedit?dates="&G2:G&"&details="&ENCODEURL( C2:C)&"&location="&ENCODEURL( B2:B)&"&text="&ENCODEURL( A2:A)))

Related

Converting text into a date not working in google sheets

I have a piece of text I need to transform into a date:
"12/28/20 10:44 PM"
Any of the usual tricks are not working to get sheets to recognize this as a date.
I've made progress parsing out the date and time into separate cells but it still won't factor in the AM PM part.
Is there a quick way to convert to a date for this type of format?
try:
=REGEXREPLACE(A1; "(\d+)\/(\d+)\/(\d+)"; "$2/$1/20$3")*1
then:

Google sheets find from named range a specified date&time display description from that named range

I'm writing a schedule for my wife and I in Google Sheets that seemed to be working but is missing some of our scheduled meetings/appointments. A link to an exact copy is found here.
The idea is that within the "Event Scheduler" I can list in DATE | TIME | DESCRIPTION and it generates a UNIQUE ID using =V14&"|"&COUNTIF(V$14:V14,V14) and also generating a DATE&TIME using DATE&TIME format. I highlight each person (or animal)'s scheduled items in named ranges named "MolliesEvents", "AydensEvents" and "DogsEvents". I now go to the main page, "Daily + Weekly" and compared the current date TODAY() and the time in the E column to the DATE&TIME column of the "Event Scheduler" sheet. Weirdly, this works for some of the scheduled items. However, a significant minority is not captured by the code that I've used. Weirder still, when I compared manually the time in the "Event Scheduler" with the time and date on the "Daily + Weekly" page I get a positive result. However, when I attempt to automate this process it does not.
You are losing events due to rounding.
For example, consider the event "Monday, March 22, 2021 11:30:00 Doctor calling".
In the 'Event Scheduler'!F18 cell is 442770.479166666666667.
In the 'Daily + Weekly'!F14 cell, you use TODAY()&E14 = 442770.479166666666666 in the formula.
Due to the fact that 442770.479166666666667 does not equal 442770.479166666666666, this event does not hit the sheet. This also applies to other lost events.
Possible Solution.
Delete the 'Time Intervals' sheet and enter the time manually on the 'Daily + Weekly' sheet in column E.
Also, I would change the formula like this:
=IFERROR(INDEX(MolliesEvents, MATCH(TODAY()&E14, 'Event Scheduler'!$F$14:$F$1000,0),3),"") (this is in the F14, copy it to other cells).
Here's an example of a spreadsheet that works well.

Roll-Forward Date Patterns in Excel

Using Excel 2010, I need to take an existing date in 2015 (i.e. 2/11/15), and calculate the same date position in the next year. In other words, whatever is the specific date pattern with the existing date, I'm looking for a formula that will help me calculate the exact same date pattern. If 2/11/15 is the second Wednesday in February of 2015, I need a formula to help me calculate (using the existing date) the second Wednesday of February in 2016.
#Jeeped, thanks for your reply. You're correct - there's many "conditions" to account for. Two colleagues helped-out with the following:
=IF('Data (Reference)'!C14>"", CONCATENATE(TEXT('Data (Reference)'!C14, "MM"),"/", TEXT(7-(WEEKDAY(CONCATENATE(TEXT('Data (Reference)'!C14,"MM"),"/", Input!$C$2))-1)-7+TEXT(WEEKDAY('Data (Reference)'!C14), "DD")+(CEILING(TEXT('Data (Reference)'!C14, "DD")/7, 1)-(IF(TEXT(WEEKDAY('Data (Reference)'!C14), "DD")
We had to consider wherever the existing date fell, and dynamically identify the pattern and/or condition and re-apply it in the roll-forward sequence.

Format times to display with 'AM/PM'

Normally, when I enter times in Google spreadsheet as 22:00:00 the display automatically switches to 10:00 PMbut sometimes it's not converting.
How can I set a common format for times in Google spreadsheet? I need this format: 8:00 PM.
Select all ranges that you wish to have this time format and go to Format > Number > More formats to select the one of your choice. (I think the one you want is near the bottom and shows as 3:59 PM.)
If you want to format a time with TEXT() to display with am/pm you can use:
=TEXT(DateField, "HAM/PM")
To get a results like
1am
1pm
10pm
12am
Use UPPER() to make it uppercase.

Google spreadsheet - how to determine timezone using function

How to use a formula to determine the current timezone?
The formula I use gives an unexpected result.
My spreadsheet settings (File > Spreadsheet settings...):
Time zone: (GMT+01:00) Amsterdam
The formula I used:
=TEXT(NOW(),"HH:mm z")
This gives:
12:47 GMT
Local clock time is 12:47, I would expect the formula to show: "12:47 GMT+1".
I also tried Z instead of z, which gives "12:47 +0000", I would expect +1.
Any suggestions?
I need this so I can determine UTC time and convert to Epoch time ("UTC time" - DATE(1970,1,1)*24*60*60)
You can't do that using formulas w/o javascript checking your local timezone.
As per this form:
https://docs.google.com/a/codeproject.com/spreadsheet/ccc?key=0AqhqY231XZd3cFBiY2VqeWdmNWdaX25zN2lpekthQlE&hl=en_US#gid=4
timezone formatting stuff is not supported in TEXT. This spreadsheet was done by one of Stackoverflow contributors, it is not mine.
So... script?
=TEXT( NOW()+x/24 , "DD/MM/YYYY HH:mm:ss" )
=TEXT( NOW()+8/24 , "DD/MM/YYYY HH:mm:ss" )
The (+x/24) after the NOW function will add x hours (in my case 8) to the standard time. NOW()+1 will give you the time tomorrow so working bakc or forward you can set the formula to give different time zones.
Hope this helps,
Robbie

Resources