Google Calendar
संग्रह की मदद से व्यवस्थित रहें
अपनी प्राथमिकताओं के आधार पर, कॉन्टेंट को सेव करें और कैटगरी में बांटें.
प्राथमिक कैलेंडर पर आज के ईवेंट सूचीबद्ध करें
function listAllEventsForToday() {
var calendarId = 'primary';
var now = new Date();
var startOfToday = new Date(now.getYear(), now.getMonth(), now.getDate(),
0, 0, 0);
var endOfToday = new Date(now.getYear(), now.getMonth(), now.getDate(),
23, 59, 29);
var calendarEvents = Calendar.Events.list(calendarId, {
timeMin: startOfToday.toISOString(),
timeMax: endOfToday.toISOString(),
singleEvents: true,
orderBy: 'startTime'
});
if (calendarEvents.items && calendarEvents.items.length > 0) {
for (var i = 0; i < calendarEvents.items.length; i++) {
var calendarEvent = calendarEvents.items[i];
if (calendarEvent.start.date) {
// All-day event.
var start = parseDate(calendarEvent.start.date);
console.log('%s (%s)', calendarEvent.summary,
start.toLocaleDateString());
} else {
var start = parseDate(calendarEvent.start.dateTime);
console.log('%s (%s)', calendarEvent.summary, start.toLocaleString());
}
}
} else {
console.log('No events found.');
}
}
मौजूदा उपयोगकर्ता के सभी कैलेंडर प्राप्त करें
function getAllCalendars() {
var calendarList = Calendar.CalendarList.list();
for (var i = 0; i < calendarList.items.length; i++) {
var calendar = calendarList.items[i];
console.log('%s, %s', calendar.id, calendar.description);
}
}
किसी मौजूदा उपयोगकर्ता के कैलेंडर पर ईवेंट बनाएं
function createEvent() {
// You can find a Google Calendar's ID from its settings page.
var calendarId = 'INSERT_CALENDAR_ID_HERE';
// Nov 1, 2014 10:00:00 AM
var start = new Date(2014, 10, 1, 10, 0, 0);
// Nov 1, 2014 11:00:00 AM
var end = new Date(2014, 10, 1, 11, 0, 0);
var calendarEvent = {
summary: 'Run account performance report',
description: 'Run account performance report for Oct.',
start: {
dateTime: start.toISOString()
},
end: {
dateTime: end.toISOString()
},
attendees: [
{email: 'alice@example.com'},
{email: 'bob@example.com'}
],
// Red background. Use Calendar.Colors.get() for the full list.
colorId: 11
};
calendarEvent = Calendar.Events.insert(calendarEvent, calendarId);
console.log('New event with ID = %s was created.' + calendarEvent.getId());
}
जब तक कुछ अलग से न बताया जाए, तब तक इस पेज की सामग्री को Creative Commons Attribution 4.0 License के तहत और कोड के नमूनों को Apache 2.0 License के तहत लाइसेंस मिला है. ज़्यादा जानकारी के लिए, Google Developers साइट नीतियां देखें. Oracle और/या इससे जुड़ी हुई कंपनियों का, Java एक रजिस्टर किया हुआ ट्रेडमार्क है.
आखिरी बार 2025-08-21 (UTC) को अपडेट किया गया.
[null,null,["आखिरी बार 2025-08-21 (UTC) को अपडेट किया गया."],[[["\u003cp\u003eThe code provides functions to interact with Google Calendar.\u003c/p\u003e\n"],["\u003cp\u003e\u003ccode\u003elistAllEventsForToday\u003c/code\u003e retrieves and displays all events scheduled for the current day from the primary calendar.\u003c/p\u003e\n"],["\u003cp\u003e\u003ccode\u003egetAllCalendars\u003c/code\u003e fetches and lists all calendars associated with the current user.\u003c/p\u003e\n"],["\u003cp\u003e\u003ccode\u003ecreateEvent\u003c/code\u003e allows the creation of a new event with specified details on a designated calendar.\u003c/p\u003e\n"]]],[],null,["# Google Calendar\n\nList today's events on primary calendar\n---------------------------------------\n\n```transact-sql\nfunction listAllEventsForToday() {\n var calendarId = 'primary';\n var now = new Date();\n var startOfToday = new Date(now.getYear(), now.getMonth(), now.getDate(),\n 0, 0, 0);\n var endOfToday = new Date(now.getYear(), now.getMonth(), now.getDate(),\n 23, 59, 29);\n var calendarEvents = Calendar.Events.list(calendarId, {\n timeMin: startOfToday.toISOString(),\n timeMax: endOfToday.toISOString(),\n singleEvents: true,\n orderBy: 'startTime'\n });\n\n if (calendarEvents.items && calendarEvents.items.length \u003e 0) {\n for (var i = 0; i \u003c calendarEvents.items.length; i++) {\n var calendarEvent = calendarEvents.items[i];\n if (calendarEvent.start.date) {\n // All-day event.\n var start = parseDate(calendarEvent.start.date);\n console.log('%s (%s)', calendarEvent.summary,\n start.toLocaleDateString());\n } else {\n var start = parseDate(calendarEvent.start.dateTime);\n console.log('%s (%s)', calendarEvent.summary, start.toLocaleString());\n }\n }\n } else {\n console.log('No events found.');\n }\n}\n```\n\nGet all of the current user's calendars\n---------------------------------------\n\n```transact-sql\nfunction getAllCalendars() {\n var calendarList = Calendar.CalendarList.list();\n for (var i = 0; i \u003c calendarList.items.length; i++) {\n var calendar = calendarList.items[i];\n console.log('%s, %s', calendar.id, calendar.description);\n }\n}\n```\n\nCreate event on one of the current user's calendar\n--------------------------------------------------\n\n```gdscript\nfunction createEvent() {\n // You can find a Google Calendar's ID from its settings page.\n\n var calendarId = 'INSERT_CALENDAR_ID_HERE';\n\n // Nov 1, 2014 10:00:00 AM\n var start = new Date(2014, 10, 1, 10, 0, 0);\n\n // Nov 1, 2014 11:00:00 AM\n var end = new Date(2014, 10, 1, 11, 0, 0);\n\n var calendarEvent = {\n summary: 'Run account performance report',\n description: 'Run account performance report for Oct.',\n start: {\n dateTime: start.toISOString()\n },\n end: {\n dateTime: end.toISOString()\n },\n attendees: [\n {email: 'alice@example.com'},\n {email: 'bob@example.com'}\n ],\n // Red background. Use Calendar.Colors.get() for the full list.\n colorId: 11\n };\n calendarEvent = Calendar.Events.insert(calendarEvent, calendarId);\n console.log('New event with ID = %s was created.' + calendarEvent.getId());\n}\n```"]]