2

I am trying to display google calendar on my website with the below Url

 <a href="https://calendar.google.com/calendar/render?
    action=TEMPLATE&
    text={{ticket.subject}}&
    dates=20170127T210000Z/20170127T220000Z&
    details=For+details,+link+here:+https://www.example.com/&
    location=Hyderabad,+Telangana,+India&sf=true&
    output=xml#eventpage_6" 
    target="_blank" rel="nofollow">Add to calender</a>

As you can observe I have hard coded the dates values as dates=20170127T210000Z/20170127T220000Z, but I couldn't able to understand the format

20170127T210000Z = 2017 01 27 but what is T210000Z?

Because I need to generate it dynamically with my ticket creation due date which was in the following

helpdesk_ticket.due_by = "2017-01-17T17:00:00-05:00"
Shiva Krishna Bavandla
  • 25,548
  • 75
  • 193
  • 313
  • 1
    T is separating the time part (hour in 24 hour furthest then minutes then seconds, each two digits). The +/- afterwards is the time zone offset. – luc Jan 18 '17 at 10:50

2 Answers2

3

It's the standard Internet Date/Time Format following the RFC3339 protocol.

The following profile of ISO 8601 [ISO8601] dates SHOULD be used in new protocols on the Internet. This is specified using the syntax
description notation defined in [ABNF].

date-time       = full-date "T" full-time
time-offset     = "Z" / time-numoffset

You can see those date properties in Calendar Events properties. To convert a date into RFC339 date-time formats in JS, use .toISOString():

var today = new Date('05 October 2011 14:48 UTC');
console.log(today.toISOString()); // Returns 2011-10-05T14:48:00.000Z
Community
  • 1
  • 1
ReyAnthonyRenacia
  • 17,219
  • 5
  • 37
  • 56
0

This is the original format from google calendar dates:

dates=20170127T210000Z/20170127T220000Z

To explain i will convert this to:

format='Ymd\\THi00\\Z+UTCTIME'

The above format it means:

Y = years
m = month
d = day
T = make it as default dont change this. (Indicates the start of the time portion of the date time)
H = hours
i = minutes
00 = make it as default dont change this.
Z = make it as defaut dont change this. (Indicates the time zone is UTC)
+UTCTIME = your utc zone

Here an example :

20220523T100000Z+07:00

This is the result of an example:

23 May 2022, 10.00am base on my utc in indonesia use +07:00 
itzmevant
  • 31
  • 4