« 2018年11月 | トップページ | 2019年1月 »

2018年12月

2018年12月17日 (月)

iCalendar形式のファイルをExcelで生成する2

以前の記事「iCalendar形式のファイルをExcelで生成する1 」での
日時の指定の方法を調べていきます。

日時は基本的には
「日付」「T」「時間」
の形式で指定します。

細かくは以下の3種類の指定方法があります。
①日付とローカルタイム
②日付とUTC時間
③日付とタイムゾーンを指定したローカルタイム

順番に見ていきます。


①日付とローカルタイム

例)20181127T010000

これは2018年11月27日01:00:00を指定します。
この指定方法では
スケジュールアプリがどのタイムゾーンでも
上記の時間になります。

ニューヨークの時間でも東京の時間でも
01:00:00になるということは、
同じ日時のスケジュールを取り込んでも
タイムゾーンが違えば別の時間になるということです。

ですので
タイムゾーンが異なる地域とのやりとりには向きません。


②日付とUTC時間
上述した①+「Z]の形式で表します。

例)20181127T010000Z

これは、2018年11月27日01:00:00 UTCを指定します。

UTCは協定世界時と言われるもので 世界の時間の基準です。

この指定方法では
スケジュールアプリがどのタイムゾーンに設定されていても
世界共通で同じ時刻を指定します。

タイムゾーンが東京の場合
UTC+0900(=標準からの時差9時間)なので
2018年11月27日10:00:00に変換されます。
タイムゾーンがニューヨークの場合
UTC-0500なので
2018年11月26日2:00:00に変換されます。


③日付とタイムゾーンを指定したローカルタイム
タイムゾーンを指定するのに
TZIDプロパティを使用します。

例)TZID=Asia/Tokyo:20181127T100000

「TZID=Asia/Tokyo:」がタイムゾーンを指定部分です。
この例では
「Asia/Tokyo」と言う名前のタイムゾーンを指定しています。
「20181127T100000」の部分は①と同様に日付と時間です。

「Asia/Tokyo」がどのようなタイムゾーンかは
VTIMEZONEコンポーネントで指定します。

下記をiCal形式のデータに記述します。

BEGIN:VTIMEZONE
TZID:Asia/Tokyo
BEGIN:STANDARD
TZOFFSETFROM:+0900
TZOFFSETTO:+0900
DTSTART:19700101T000000
END:STANDARD
END:VTIMEZONE

別のタイムゾーンを指定したいときは、
上の例の「Asia/Tokyo」を別のタイムゾーン名にして
「+0900」部分をUTCからの適切な時差に修正してください。

| | コメント (0) | トラックバック (0)

2018年12月 9日 (日)

Generate files in iCalendar format in Excel 1

The file of iCalendar format
(hereinafter referred to as iCal format)
Can be output by schedule application
such as Google Calendar.
It contains the data of the schedule.

With this file type
You can exchange schedules
among schedule applications.

I want to generate iCal format files by Excel.
What is iCal format?
I'm gonna start from the point.

This time I will examine the data contents of iCal format.

Input events in Google Calendar, then
We can export the schedule in iCal format from Google Calendar.
I'll check at the contents of the file I have exported.

With Google Calendar
To export all schedules
Please select in following order.
"Settings" - "Import / Export" - "Export"

When exporting schedules only for a specific calendar
After clicking "Setting"
Select a item of my calendar you want to output
and click "Export Calendar".
For details, please see the following page
"Export your Google calendar"

The output file is in iCal format.
The extension is ".ics".
If you modify this extension to ".txt"
You can see and edit the contents in Windows Notepad.

Compare the Google Calendar input screen
to the output file.
in the image below.
Leave data only for frequently used parts,
others have been deleted.

Vba20181125a_en

BEGIN:VCALENDAR

END:VCALENDAR

This part is an essential part of iCal format.

BEGIN:VEVENT

END:VEVENT

This part is the schedule.
Each item of the schedule
is specified in the form of "item: value".

In case of ①,
the item is SUMMARY and the value is MEETING.
So it is specified as following,

SUMMARY: MEETING

Please compare ① ~ ⑤
for checking items of schedule.
② and ③ are items of start Date-Time
and end Date-Time.

It is written in UTC time.
(The last letter of the alphabet "Z" indicates UTC time.)

For example,
② represents the next Date-Time.
20181127 T 010000 Z = November 27, 2018 01: 00: 00 (UTC)

Japan time is UTC + 9.
When importing to the calendar application
set to Japan Standard Time,
it will be converted to the following Date-Time.
November 27, 2018 10: 00: 00

I would like to introduce
how to specify a Date-Time in another article.

| | コメント (0) | トラックバック (0)

« 2018年11月 | トップページ | 2019年1月 »