import java.util.*;
import java.text.*;
import java.sql.Timestamp;public class tsTest
{
public static void main(String[] args){
Date d = new Date();
SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMdd");
Timestamp ts;
String dd = "20030820";
try{
d = sdf.parse(dd);
}catch(Exception e){
}
ts = new Timestamp(d.getTime());
System.out.println("ts is: "+ts);
}
};
//good luck
import java.text.*;
import java.sql.Timestamp;public class tsTest
{
public static void main(String[] args){
Date d = new Date();
SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMdd");
Timestamp ts;
String dd = "20030820";
try{
d = sdf.parse(dd);
}catch(Exception e){
}
ts = new Timestamp(d.getTime());
System.out.println("ts is: "+ts);
}
};
//good luck
解决方案 »
- SSH框架 “org.objectweb.asm.ClassWriter.<init>(I)V”
- jquery中,不管选择下拉列表哪一项,返回的值都是第一项的value值
- 用JAVA怎么实现短信平台接口,求详解!
- sql server方言问题
- 谁能发给我一些ssh的项目?
- eclipse+myeclipse中不能建立jsp文件,高手进,顶者有分!!~~
- 在线等,Java中如何实现在jsp页面在线预览文档
- 怎么会这样??????
- 为什么出现“package javax.servlet does not exist”的错误!`
- 求大神帮帮忙,我是初学者
- html转换成xsl文件,在线等待
- 如何在命令提示符窗中运行java文件,编译成功了,但运行检测是找不到main()方法
<%
java.util.Date now = new java.util.Date();
java.text.SimpleDateFormat formatter_time = new java.text.SimpleDateFormat("yyyyMMddkkmm");
String now_time = formatter_time.format(now);
%>
<%=now_time%>
//good luck
public Timestamp getTS(String p0){
Date d = new Date();
SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMdd");
Timestamp ts;
try{
d = sdf.parse(p0);
}catch(Exception e){
}
ts = new Timestamp(d.getTime());
return ts;
}