怎么在JAVAME中的得到北京时间 比如Date d=new Date("",int ,?); 第三个参数怎么弄
1个回答
展开全部
import java.util.Calendar;
import java.util.TimeZone;
public void getNowTime(){
TimeZone timeZone = TimeZone.getDefault();// 获取时区
Calendar calendar = Calendar.getInstance(timeZone);//创建Calendar
System.out.println("年"+calendar.get(Calendar.YEAR));
System.out.println("月"+(calendar.get(Calendar.MONTH)+1));
System.out.println("日"+calendar.get(Calendar.DATE));
System.out.println("时"+calendar.get(Calendar.HOUR_OF_DAY)
System.out.println("分"+calendar.get(Calendar.MINUTE));
System.out.println("秒"+calendar.get(Calendar.SECOND));
}
import java.util.TimeZone;
public void getNowTime(){
TimeZone timeZone = TimeZone.getDefault();// 获取时区
Calendar calendar = Calendar.getInstance(timeZone);//创建Calendar
System.out.println("年"+calendar.get(Calendar.YEAR));
System.out.println("月"+(calendar.get(Calendar.MONTH)+1));
System.out.println("日"+calendar.get(Calendar.DATE));
System.out.println("时"+calendar.get(Calendar.HOUR_OF_DAY)
System.out.println("分"+calendar.get(Calendar.MINUTE));
System.out.println("秒"+calendar.get(Calendar.SECOND));
}
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询