易截截图软件、单文件、免安装、纯绿色、仅160KB

java格式化日期时间的函数

Date date = new Date();
SimpleDateFormat sdf = new SimpleDateFormat("yyyy年MM月dd日 HH:mm:ss");
System.out.println(sdf.format(date));
SimpleDateFormat sdf2 = new SimpleDateFormat("MM");
System.out.println(sdf2.format(date));
Calendar c = Calendar.getInstance();
System.out.println(c.get(Calendar.MONTH)+1);
Date d=new Date(2010,5,12,13,24,30);
c.setTime(d);
System.out.println(c.get(Calendar.MONTH)+1);
--------------------------------------------------------------------
test=new JdbcTest();
  String sql="{call proc_select3(?)};"; //调用语句
  try {
   CallableStatement proc=test.getConnection().prepareCall(sql);
   proc.setString(1, "男");
   //proc.execute();
      ResultSet rs= proc.executeQuery();
      while(rs.next())
      {
       System.out.print("id: "+rs.getInt("id"));
    System.out.print(" userName :"+rs.getString("username"));
    System.out.print(" age :"+rs.getInt("age"));
    System.out.println(" sex :"+rs.getString("sex"));
    Timestamp time=rs.getTimestamp("birthday");
    SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
    System.out.println(">>>>>>>>>>>>>>>>>>"+sdf.format(time));
    System.out.println(" birthday :"+rs.getDate("birthday"));
      }
   
   
  } catch (SQLException e) {
   // TODO 自动生成 catch 块
   e.printStackTrace();
  }


相关文档:

Java中的字符串鼠标和键盘事件

字符串
1、获取字符串的长度 
length() 
2 、判断字符串的前缀或后缀与已知字符串是否相同 
前缀 startsWith(String s) 
后缀 endsWith(String s) 
3、比较两个字符串 
equals(String s) 
4、把字符串转化为相应的数值 
int型 Integer.parseInt(字符串) 
......

Java线程知识深入解析(1)

一般来说,我们把正在计算机中执行的程序叫做"进程"(Process) ,而不将其称为程序(Program)。所谓"线程"(Thread),是"进程"中某个单一顺序的控制流。新兴的操作系统,如Mac,Windows NT,Windows 95等,大多采用多线程的概念,把线 程视为基本执行单位。线程也是Java中的相当重要的组成部分之一。
甚至最简单的Applet也是由多个线 ......

Java中 ArrayList、Vector和LinkedList 的使用


ArrayList是最常用的List实现类,内部是通过数组实现的,它允许对元素进行快速随机访问。数组的缺点是每个元素之间不能含有“空隙”,当数组大小不满足时需要增加存储能力,就要将已有数组数据复制到新的存储空间中。当从ArrayList的中间位置插入或者删除元素时,需要对数组进行复制、移动,代价比较高。因此, ......

java时间函数

 http://blog.sina.com.cn/s/blog_503cf9f80100b9lf.html
java时间函数(2008-12-06 22:25:46)
<> 标签:杂谈 
注意:java.util和java.sql中都有Date这个类,不知道用哪一个了,你可以写死java.sql.Date time = .....
1. Java计算时间依靠1970年1月1日开始的毫秒数.     &nbs ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号