String d=new SimpleDateFormat("yyyy-MM-dd HH:mm:ss ww").format(new Date());
//最后两位是Week in year
String d=new SimpleDateFormat("yyyy-MM-dd HH:mm:ss WW").format(new Date());
//最后两位是Week in month
//最后两位是Week in year
String d=new SimpleDateFormat("yyyy-MM-dd HH:mm:ss WW").format(new Date());
//最后两位是Week in month
解决方案 »
- jsp登陆成功后几秒后跳转
- MyBatis 取出insert的lastid
- struts2+hibernate 做集成,
- hibernate many-to-many list 中 index问题?
- jsp 问题请高手赐教
- servlet中用什么方法能使输入的URL以中文结尾
- org.springframework.beans.factory.BeanCreationException spring配置的sessionFactory不能创建
- 連接sql2000所產生問題
- 在tomacat下出现http status 500错误,错误信息如下!望各位指点一下,找了一上午也没什么结果!多谢
- 请问下面这段代码是什么意思?
- 问一个weblogic服务器的问题!!
- 跪求!光怪陆离,之————用 Cloudscape 数据库的可视工具 Cloudview 创建数据库的问题
的前面
要不要插入 import java.util.*;
import java.util.*;
int year=calendar.get(calendar.YEAR);
int month=calendar.get(calendar.MONTH)+1;
int day=calendar.get(calendar.DAY_OF_MONTH);
int week=calendar.get(calendar.DAY_OF_WEEK)-1;
int hour=calendar.get(calendar.HOUR_OF_DAY);
int minute=calendar.get(calendar.MINUTE);
int second=calendar.get(calendar.SECOND); // String date=new Date().toString();
String date=year+"年"+month+"月"+day+"日"+hour+"时"+minute+"分"+second+"秒"+getWeek(week);
public String getWeek(int week){
int temp=week;
String weekday="";
if (temp == 1) weekday = "星期一";
else if (temp == 2) weekday = "星期二";
else if (temp == 3) weekday = "星期三";
else if (temp == 4) weekday = "星期四";
else if (temp == 5) weekday = "星期五";
else if (temp == 6) weekday = "星期六";
else if (temp == 7) weekday = "星期日";
return weekday;
}
String d=new SimpleDateFormat("yyyy-MM-dd HH:mm:ss EEE").format(new Date());
Calendar c = Calendar.getInstance();
int i = c.get(Calendar.DAY_OF_WEEK)-1;
String day[] = new String[]{"星期日","星期一","星期二","星期三","星期四","星期五","星期六"};
system.out.println(day[i]);
Date date = new Date(); 前面要不要插入import java.util.*;
是怎么用的,有例子吗?