java将日期转换成周几


   Date date=new Date();

   SimpleDateFormat dateFm = new SimpleDateFormat("EEEE");

   dateFm.format(date);


   String[] weekDays = {"星期日", "星期一", "星期二", "星期三", "星期四", "星期五", "星期六"};
   Calendar calendar = Calendar.getInstance();
   calendar.setTime(dt);
i
nt i = calendar.get(Calendar.DAY_OF_WEEK) - 1; if (i < 0){ i = 0;
  }
return weekDays[i];

 


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM