質問編集履歴

4

コード追記

2018/07/24 06:55

投稿

system1987
system1987

スコア15

test CHANGED
File without changes
test CHANGED
@@ -60,6 +60,60 @@
60
60
 
61
61
  name=New,abbr=N,since=1530403200000
62
62
 
63
+
64
+
65
+
66
+
67
+ //Javaソース(画面から西暦で入力した日付を、和暦に変換しExcelへ出力するものです。)
68
+
69
+ Row row_card_date = sheet.getRow(18);
70
+
71
+ Cell cell_card_date = row_card_date.getCell(6);
72
+
73
+
74
+
75
+ int year = Calendar.getInstance().get(Calendar.YEAR);
76
+
77
+ int month = Calendar.getInstance().get(Calendar.MONTH)+1;
78
+
79
+ int day = Calendar.getInstance().get(Calendar.DATE);
80
+
81
+ if(!Tool.isNullOrEmpty(params.get("card_date"))){
82
+
83
+ year = Integer.parseInt(params.get("card_date").substring(0, 4));
84
+
85
+ month = Integer.parseInt(params.get("card_date").substring(5, 7));
86
+
87
+ day = Integer.parseInt(params.get("card_date").substring(8, 10));
88
+
89
+ }
90
+
91
+ String wa = Tool.wa(year, true);
92
+
93
+ cell_card_date.setCellValue(wa+"年"+month+"月"+day+"日");
94
+
95
+
96
+
97
+ //和暦への変換コード
98
+
99
+ public static String wa(int year, boolean gengo) {
100
+
101
+ Calendar c = Calendar.getInstance();
102
+
103
+ c.set(Calendar.YEAR, year);
104
+
105
+ return (gengo ? Define.GGGGyyyy : Define.YEAR_WA).format(c.getTime());
106
+
107
+
108
+
109
+ //Excelへの出力内容
110
+
111
+ 2018/01/01と入力時:New元年1月1日
112
+
113
+ 2018/07/01と入力時:New元年7月1日
114
+
115
+
116
+
63
117
  ```
64
118
 
65
119
 

3

改善

2018/07/24 06:54

投稿

system1987
system1987

スコア15

test CHANGED
File without changes
test CHANGED
File without changes

2

誤字

2018/07/24 06:41

投稿

system1987
system1987

スコア15

test CHANGED
File without changes
test CHANGED
@@ -78,7 +78,7 @@
78
78
 
79
79
  お客様環境のため、アップデートは難しいと思いますので、
80
80
 
81
- で実現したいと考えております。
81
+ で実現したいと考えております。
82
82
 
83
83
 
84
84
 

1

コード修正

2018/07/24 06:36

投稿

system1987
system1987

スコア15

test CHANGED
File without changes
test CHANGED
@@ -44,7 +44,7 @@
44
44
 
45
45
  # Heisei since 1989-01-08 00:00:00 local time (Gregorian)
46
46
 
47
- # New since 2018-05-01 00:00:00 local time (Gregorian)
47
+ # New since 2018-07-01 00:00:00 local time (Gregorian)
48
48
 
49
49
  calendar.japanese.type: LocalGregorianCalendar
50
50