Quantcast
Channel: OKWAVE 閲覧数の多い質問(Java/253)【本日】
Viewing all articles
Browse latest Browse all 68675

時間の取得

$
0
0
失礼致します。よろしくお願いします。 今、現在の時間を取得しようとしています。 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

Viewing all articles
Browse latest Browse all 68675

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>