我想获得当前系统的时间值,并分开表示出来
现在获得的分钟和秒时间不对,谁能帮我看看
java.util.Date d = new java.util.Date();
java.text.SimpleDateFormat fm= new java.text.SimpleDateFormat("yyyy-MM-dd HH:MM:SS"); //the date format
//out.print(fm);
String strDate=fm.format(d);
//out.print(strDate+strDate.length());
String year,month,day,hour,minute,second;
int ye,mo,da,ho,mi,se;
year=strDate.substring(0,4);
month=strDate.substring(5,7);
day=strDate.substring(8,10);
hour=strDate.substring(11,13);
minute=strDate.substring(14,16);
second=strDate.substring(17,18);
ye=new Integer(year).intValue();
mo=new Integer(month).intValue();
da=new Integer(day).intValue();
ho=new Integer(hour).intValue();
mi=new Integer(minute).intValue();
se=new Integer(second).intValue();
现在获得的分钟和秒时间不对,谁能帮我看看
java.util.Date d = new java.util.Date();
java.text.SimpleDateFormat fm= new java.text.SimpleDateFormat("yyyy-MM-dd HH:MM:SS"); //the date format
//out.print(fm);
String strDate=fm.format(d);
//out.print(strDate+strDate.length());
String year,month,day,hour,minute,second;
int ye,mo,da,ho,mi,se;
year=strDate.substring(0,4);
month=strDate.substring(5,7);
day=strDate.substring(8,10);
hour=strDate.substring(11,13);
minute=strDate.substring(14,16);
second=strDate.substring(17,18);
ye=new Integer(year).intValue();
mo=new Integer(month).intValue();
da=new Integer(day).intValue();
ho=new Integer(hour).intValue();
mi=new Integer(minute).intValue();
se=new Integer(second).intValue();
解决方案 »
- struts2上传Excel文件,再解析...非常头疼,请高手现身!!!!!!!!!!!!!!!!
- 怎样将工程部署到Tomcat“根目录”下!
- java程序如果实现读写U盘内容
- tomcat做web发布,程序里涉及到了中文路径,它不支持怎么办??????????
- 我调试JSP发送email时出现的错误,请帮我看一下。
- 在jsp或java里如何比较字符串的大小
- 关于servlet的问题,郁闷,高手进[JSP]
- 模板下载代码
- 打开新的窗口引入参数问题。。急。。
- 在线:JAVAMAIL发送邮件给多个收件人
- 请问如何使用数据库中字段的“自动增量”方式?附源码
- 插入oracle和MySQL"yyyy-mm-dd hh:mm:ss"型时间问题
改为
java.text.SimpleDateFormat fm= new java.text.SimpleDateFormat("yyyy-MM-dd HH:mm:ss")
java.util.Date tdate = new java.util.Date();
String nowtime = new Timestamp(tdate.getTime()).toString();
nowtime = nowtime.substring(0, 19);//得到当前系统时间,带时分秒