[下图是我网页的屏幕截图,我正在创建一个gae应用,该应用将一些数据存储在Google数据存储中,但在客户端使用日期格式存在一些困难,我正在使用Anugularjs日期,如图所示,我想存储该日期,但我也想在Java中分隔该日期的日期月份和年份
Like on any other Java 7 system, a typical pattern (after the appropriate imports at the top of your Java code) would be:
Calendar calendar = new GregorianCalendar();
int year = calendar.get(Calendar.YEAR);
int month = calendar.get(Calendar.MONTH);
int day = calendar.get(Calendar.DAY_OF_MONTH);
That's because java.util.Date
, which used to be the natural way to do things, is mostly deprecated in Java 7 (though AFAIK it still works).
In Java 8 you'd use java.time
, but GAE does not yet support Java 8.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.