심재운 블로그

728x90
반응형


 


Google Calendar

Google’s instructions for publishing events are already about as simple as they can get, but I’ll summarise the basics here for the sake of completeness.

The components of my URL are:

http://www.google.com/calendar/event? - The location of this API
action=TEMPLATE - Don’t edit this unless you know more than me (not hard).
I haven’t found any other interesting values.
text=My Event Put the title of your event in here
dates=20080101/20080101 The start and end dates for your event (YYYYMMDD).
If you want to specify an exact time instead of just the date then use YYYYMMDDTHHmmSS, e.g. 20080101T143000 would be half past two on the 1st Jan 2008.
If you specify times don’t forget to convert them to PST (GMT -8 hours).
sprop=website:www.justgiving.com &sprop=name:Justgiving The documentation says this is to identify the website or event source. It says it’s required, but excluding it seems to make no difference.
details=Don’t forget to donate at http://www.justgiving.com/richtest001 This is the description of your event. Don’t forget to URL Encode. Using Carriage Return and Line Feed characters seems to work fine. These encode to %0D and %0A respectively so %0D%0A will create a new line when decoded at Google’s end.

 

Insert test event into your Google calendar.

 

Google Calendar doesn’t return you to the original site when it finishes adding the event, so you may want to think about opening this link in a new window, either with window.open(), or preferably an HTML link using the target attribute.

There doesn’t appear to be any provision for adding reminders or recurring events using this URL format.

 

 

 

위의 날짜 (dates) 는.. 아래 코드를 활용하며 됨

 


<script>

function pad(num) {
    return ("0" + num).slice(-2);
}

function formatDate(d) {
    return [d.getUTCFullYear(),
            pad(d.getUTCMonth() + 1),
            pad(d.getUTCDate())].join("") + "T" +
           [pad(d.getUTCHours()),
            pad(d.getUTCMinutes()),
            pad(d.getUTCSeconds())].join("") + "Z";
}

//2015년 2월 18일 오전 5시 30분
var dt = new Date(2015,02,18,05,30,00);

//20150317T203000Z
var gmtDate = formatDate(dt);
alert(gmtDate);

</script>

 

 

728x90
반응형

이 글을 공유합시다

facebook twitter kakaoTalk kakaostory naver band

본문과 관련 있는 내용으로 댓글을 남겨주시면 감사하겠습니다.

비밀글모드