失礼致します。よろしくお願いします。 今、現在の時間を取得しようとしています。 Date today=new Date(); SimpleDateFormat dateForm=new SimpleDateFormat("yyyy-MM-dd"); Calendar calendar = new GregorianCalendar(); Date NowTime = new Date(); calendar.setTime(NowTime); //☆ int year=calendar.get(Calendar.YEAR); // 年の取得 String stryear = Integer.toString(year); int month=calendar.get(Calendar.MONTH)+1; // 月の取得 String strmonth = Integer.toString(month); という流れで年月日をとりました。 しかし☆の所で「トークン "NowTime" に構文エラーがあります。このトークンの後には VariableDeclaratorId を指定する必要があります。」「トークンに構文エラーがあります。構成の位置が間違っています。」とでます。 他のソースではうまくいったのにどうして駄目なのか分かりません。 importもしてますし、{}等の間違いもないはずです。 何が悪いのでしょうか?よろしくお願いします。m(__)m
↧