Date SDate=rs.getDate(1);
int year=SDate.getYear();
int month=SDate.getMonth();
int day=SDate.getDay();
int year=SDate.getYear();
int month=SDate.getMonth();
int day=SDate.getDay();
解决方案 »
- tomcat问题
- 帮我推荐几本书
- 我很贪心!!
- 关于jsp传递数组的问题!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
- 求教高手,如果我不想通过FILE对话框选择文件上传,而是直接指定文件名的话,可以实现吗?
- 网页间中文参数传递的编码问题,困扰我多时
- 在JSP中如何显示access数据库的全部数据?
- Web应用中的数据传输问题
- jsp页面加载时,怎么立即将servlet的内容展现在页面上
- 急!!!!tomcat服务器,linux系统下的JSP文件如何解决中文乱码问题?必有重谢!
- 我是菜鸟,所以问个很菜的问题,请别见笑。在JBuilder9中如何创建一个Servlet?为什么编译的时候说Import javax.servlet.*找不到呢?
- 请教:在JBuilder怎么样加入SQL 2000的驱动包?
select to_char(rq,'yyyy') from tbl;
select to_char(rq,'mm') from tbl;
select to_char(rq,'dd') from tbl;
select to_char(rq,'yyyy'),to_char(rq,'mm'),to_char(rq,'dd') from tbl;
select to_char(rq,'yyyy'),to_char(rq,'mm'),to_char(rq,'dd') from tbl;
这个好象是oracle数据库中的功能吧
int year=SDate.getYear();
int month=SDate.getMonth();
int day=SDate.getDay();
我试了,为什么不行????????!!!!!! 兄弟们帮帮我呀!!!!!!!!!!!!!!
int year=SDate.getYear();
int month=SDate.getMonth();
int day=SDate.getDay();
int year=SDate.getYear();
int month=SDate.getMonth();
int day=SDate.getDay();我这样试了,报错::::
javax.servlet.ServletException: [Microsoft][ODBC SQL Server Driver]无效的描述符索引
这是怎么回事,我该如何作呢????
高手助我!!!!!!!!!!!!!!!!!!!!
相关的代码帖出来看看
<%
String sql="select Title,Content,PictureURL,PubDate from OnePub where ID="+idno+"and Category="+category;
conn2=detail.getConn();
stmt2=conn2.createStatement();
ResultSet result2=stmt2.executeQuery(sql);
//-------------------------fetching the data-------------------------------------------- -
if(result2.next()){
java.util.Date pubdate=result.getDate(17);
title=result2.getString("Title");
content=result2.getString("Content");
picurl=result2.getString("PictureURL");
//pubdate=result2.getDate(17);
year=pubdate.getYear();
month=pubdate.getMonth();
day=pubdate.getDay();
%>
year(YourFieldOfDatetimeType),
month(YourFieldOfDatetimeType),
day(YourFieldOfDatetimeType)
from ....
java.util.Date pubdate=result.getDate(17);
上面那句result也没定义,还有你要取的是不是PubDate的值
那应该是在第四个呀.所以索引出错的.
java.util.Date pubdate=result2.getDate(4);
2.引用java.text.SimpleDateFormat定义SimpleDateFormat对象
3.用SimpleDateFormat对象方法格式化日期
yeah = time.substring(x,y);
month= time.substring(n,m);
.....
pubyear=pubdate.getYear()+1900;
pubmonth=pubdate.getMonth()+1;
pubday=pubdate.getDate();
enddate=result.getDate(4);
endyear=enddate.getYear()+1900;
endmonth=enddate.getMonth()+1;
endday=enddate.getDate();
我这样搞定了!! 谢谢各位兄弟!!!!!!!!!!!!!!