| 名前空間一覧 > GrapeCity.Web.Input.IMDate 名前空間 > GcDateTime クラス : Format プロパティ |
| 例外 | 解説 |
|---|---|
| System.ArgumentException | 無効な書式が設定されています。 |
| キーワード | 説明 |
|---|---|
| g | 年号の頭文字をアルファベットで表示(M、T、S、H) |
| gg | 年号の頭文字を漢字で表示(明、大、昭、平) |
| ggg | 年号の正式名称を漢字で表示(明治、大正、昭和、平成) |
| e | 和暦年を2桁で表示(先頭に0を付けない) |
| ee | 和暦年を2桁で表示(先頭に0を付ける) |
| yy | 年を2桁で表示(先頭に0を付ける) |
| yyyy | 年を4桁で表示(先頭に0を付ける) |
| MM | 月を2桁の数字で表示(先頭に0を付ける) |
| MMM | 月を省略形で表示 (DateTimeFormatInfo.AbbreviatedMonthNames() で指定された形式) |
| MMMM | 月を正式名称で表示 (DateTimeFormatInfo.MonthNames()で指定された形式) |
| dd | 日を2桁で表示(先頭に0を付ける) |
| \(Chr(92)) | キーワードをリテラル文字として表示 |
| 元号 | 明治 | 大正 | 昭和 | 平成 |
|---|---|---|---|---|
| 数値入力 | 1 | 2 | 3 | 4 |
| 文字入力 | m | t | s | h |
以下の時刻に関するキーワードは、日付コントロール(GcDateクラス)ではサポートされません。
| キーワード | 説明 |
|---|---|
| t | 12時間制で時刻を表示するときに午前(AMDesignatorプロパティで設定)または午後(PMDesignatorプロパティで設定)を表す文字列の最初の1文字を表示 |
| tt | 12時間制で時刻を表示するときに午前(AMDesignatorプロパティで設定)または午後(PMDesignatorプロパティで設定)を表す文字列を表示 |
| hh | 時を12時間制で表示(先頭に0を付ける) |
| HH | 時を24時間制で表示(先頭に0を付ける) |
| mm | 分を表示(先頭に0を付ける) |
| ss | 秒を表示(先頭に0を付ける) |
| \(Chr(92)) | キーワードをリテラル文字として表示 |
| 区分 | 午前 | 午後 |
|---|---|---|
| 数値入力 | 1 | 2 |
| 文字入力 | a | p |
' 日付の書式を設定します。 GcDateTime1.Format.Pattern = "ggg ee年 MM月 dd日" GcDateTime1.DisplayFormat.Pattern = "ggg ee年 MM月 dd日" ' 時刻の書式を設定します。 GcDateTime1.AMDesignator = "午前" GcDateTime1.PMDesignator = "午後" GcDateTime1.Format.Pattern = "tt hh時 mm分" GcDateTime1.DisplayFormat.Pattern = "tt hh時 mm分"
// 日付の書式を設定します。 GcDateTime1.Format.Pattern = "ggg ee年 MM月 dd日"; GcDateTime1.DisplayFormat.Pattern = "ggg ee年 MM月 dd日"; // 時刻の書式を設定します。 GcDateTime1.AMDesignator = "午前"; GcDateTime1.PMDesignator = "午後"; GcDateTime1.Format.Pattern = "tt hh時 mm分"; GcDateTime1.DisplayFormat.Pattern = "tt hh時 mm分";
Imports GrapeCity.Web.Input.IMDate ' 日付の書式を設定します。 GcDateTime1.Format = New DateFormat("ggg ee年 MM月 dd日") GcDateTime1.DisplayFormat = New DateDisplayFormat("ggg ee年 MM月 dd日") ' 時刻の書式を設定します。 GcDateTime1.AMDesignator = "午前" GcDateTime1.PMDesignator = "午後" GcDateTime1.Format = New DateFormat("tt hh時 mm分") GcDateTime1.DisplayFormat = New DateDisplayFormat("tt hh時 mm分")
using GrapeCity.Web.Input.IMDate; // 日付の書式を設定します。 GcDateTime1.Format = new DateFormat("ggg ee年 MM月 dd日"); GcDateTime1.DisplayFormat = new DateDisplayFormat("ggg ee年 MM月 dd日"); // 時刻の書式を設定します。 GcDateTime1.AMDesignator = "午前"; GcDateTime1.PMDesignator = "午後"; GcDateTime1.Format = new DateFormat("tt hh時 mm分"); GcDateTime1.DisplayFormat = new DateDisplayFormat("tt hh時 mm分");