Get the date to copy to google calendar

I created action, โ€˜Add to GCalโ€™. It is a button on a order.
If the appointment date is filled up, the button appears and then when clicked will be redirected to google calendar.
I so far managed to get the name, remarks and location from appsheet automatically copied to the form through this code:

CONCATENATE(
โ€œhttps://www.google.com/calendar/render?action=TEMPLATE&text=โ€,
ENCODEURL([ContactRec].[Name]),
โ€œ&dates=โ€,
ENCODEURL([TIME FORMAT FOR GCAL]),
โ€œ&details=โ€,
ENCODEURL("Remarks: โ€œ), ENCODEURL( [Remarks]), ENCODEURL(โ€ Next Topic: "), ENCODEURL([Next_Topic]),
โ€œ&location=โ€,
ENCODEURL([ContactRec].[Territory]),
โ€œ&sf=true&output=xmlโ€
)

I am simply unable to grab the date. It must be the date format.

I tried this:
TEXT([AppointmentDate], โ€œYYYY/DD/MM/HH/MM/SSโ€)

Solved Solved
0 6 323
1 ACCEPTED SOLUTION

Try:

SUBSTITUTE(
  "{}/{}",
  "{}",
  CONCATENATE(
    TEXT(
      [AppointmentDate],
      "YYYYMMDD"
    ),
    "T",
    TEXT(
      "02:00:00,
      "HHMMSS"
    )
  )
)

See also:

View solution in original post

6 REPLIES 6

Steve
Platinum 4
Platinum 4

What do you mean by this? Does your data include the date and time you need? Do you need the current date and time? Please clarify.

Yes, I need the date in the format it needs to be so I can add it too google calendar.
Like this: 20161208T160000/20161208T180000

I simply do not know how, I tried this formula:
CONCATENATE(YEAR([AppointmentDate]),MONTH([AppointmentDate]),DAY([AppointmentDate]),โ€œTโ€,HOUR(โ€œ002:00:00โ€),MINUTE(โ€œ002:00:00โ€),SECOND(โ€œ002:00:00โ€)"/"YEAR([AppointmentDate]),MONTH([AppointmentDate]),DAY([AppointmentDate]),โ€œTโ€,HOUR(โ€œ002:00:00โ€),MINUTE(โ€œ002:00:00โ€),SECOND(โ€œ002:00:00โ€))

Try:

SUBSTITUTE(
  "{}/{}",
  "{}",
  CONCATENATE(
    TEXT(
      [AppointmentDate],
      "YYYYMMDD"
    ),
    "T",
    TEXT(
      "02:00:00,
      "HHMMSS"
    )
  )
)

See also:

Perfect! I have not tried Substitute before. Works like a charm

Instead of TEXT() use YEAR(), MONTH() and DAY() functions to get the desired format.

What you need to pass is the ISO format - I got this from stack overflow:

  • dates (ISO date format, startdate/enddate - must have both start and end time or it wonโ€™t work. The start and end date can be the same if appropriate.)
    • to use the userโ€™s timezone: 20161208T160000/20161208T180000
    • to use global time, convert to UTC, then use 20131208T160000Z/20131208T180000Z
    • all day events, you can use 20161208/20161209 - note that the old google documentation gets it wrong. You must use the following date as the end date for a one day all day event, or +1 day to whatever you want the end date to be.

I feel like this could be my answer, how would I put it as my formula though:

I tried this and it isnโ€™t working.
CONCATENATE(YEAR([AppointmentDate]),MONTH([AppointmentDate]),DAY([AppointmentDate]),โ€œTโ€,HOUR(โ€œ002:00:00โ€),MINUTE(โ€œ002:00:00โ€),SECOND(โ€œ002:00:00โ€)"/"YEAR([AppointmentDate]),MONTH([AppointmentDate]),DAY([AppointmentDate]),โ€œTโ€,HOUR(โ€œ002:00:00โ€),MINUTE(โ€œ002:00:00โ€),SECOND(โ€œ002:00:00โ€))

AppointmentDate is where the date is.

Top Labels in this Space