解决了立马送分,顶也有,date2week的问题 从数据库把日期取出来了,格式是2006-03-25 ,怎么算这天是星期几啊 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 import java.util.Calendar;public class Demo { final static String [] NAME =new String[]{"", "SUNDAY" ,"MONDAY", "TUESDAY" ,"WEDNESDAY", "THURSDAY" , "FRIDAY" , "SATURDAY"}; public static void main(String[] args) { System.out.println(NAME[getDayOfWeek(2006,3,1)]); } public static int getDayOfWeek(int year,int month,int day){ Calendar c = Calendar.getInstance() ; c.set(year,month-1,day); return c.get(Calendar.DAY_OF_WEEK); }} wizardblue(不死鱼) 的方法我在网上搜到的,不实用 <%=Date2Week(getShortDate(scp.getTime()))%>getShortDate法是这样 public static String getShortDate(long lngTime) { return getShortDate(new Date(lngTime)); }Date2Week方法如下 public static String Date2Week(String ymd) { try { Date date = df.parse(ymd); return df_week.format(date); } catch (ParseException e) { // TODO Auto-generated catch block e.printStackTrace(); return null; } }其中public static SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd"); public static SimpleDateFormat df_week = new SimpleDateFormat("E");现在ok了 请求大牛们解决换行问题 新人快帮我谢谢给分解决马上结贴 能编译不能运行 关于时间转换 简单问题 如何通过ibatis从数据库中取出数据并生成一个个文件 一个时间的处理,应该怎么做,大家救救急,谢谢了? 算法设计 问:java的前途? 怎样把applet上的指定矩形区域转成Image??? 谁能帮忙写个方法,马上送分~ 急急急:怎么new String(userName.getBytes("ISO-8859-1"),"GBK")).getBytes()反转回来?
final static String [] NAME =new String[]{"",
"SUNDAY" ,"MONDAY", "TUESDAY" ,"WEDNESDAY", "THURSDAY" , "FRIDAY" , "SATURDAY"};
public static void main(String[] args) {
System.out.println(NAME[getDayOfWeek(2006,3,1)]);
}
public static int getDayOfWeek(int year,int month,int day){
Calendar c = Calendar.getInstance() ;
c.set(year,month-1,day);
return c.get(Calendar.DAY_OF_WEEK);
}}
public static String getShortDate(long lngTime)
{
return getShortDate(new Date(lngTime));
}Date2Week方法如下
public static String Date2Week(String ymd) {
try {
Date date = df.parse(ymd);
return df_week.format(date);
} catch (ParseException e) {
// TODO Auto-generated catch block
e.printStackTrace();
return null;
}
}其中public static SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd");
public static SimpleDateFormat df_week = new SimpleDateFormat("E");现在ok了