1获得当前日期
Date now = new Date();
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss");//可以方便地修改日期格式
String hehe = dateFormat.format( now );
或简写为:
String opertime = new SimpleDateFormat("yyyy-MM-dd").format(new Date());
---------------------------------------------------------------------------------------------------------------------------
2 解决火狐不居中问题
body{text-align:center}
div{margin:0 auto;}
---------------------------------------------------------------------------------------------------------------------------
3 如何取得一个数据表的所有列名
方法如下:先从SYSTEMOBJECT系统表中取得数据表的SYSTEMID,然后再SYSCOLUMN表中取得该数据表的所有列名。
SQL语句如下:
declare @objid int,@objname char(40)
set @objname = 'tablename'
select @objid = id from sysobjects where id = object_id(@objname)
select 'Column_name' = name from syscolumns where id = @objid order by colid
---------------------------------------------------------------------------------------------------------------------------
4 swing主题样式的设置
参考设置字体 http://blog.sina.com.cn/s/blog_703e3c800100mzmn.html
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()) ; // 当前系统风格
UIManager.setLookAndFeel("com.sun.java.swing.plaf.motif.MotifLookAndFeel") ; // Motif风格,外观接近windows经典,但宽宽大大,而且不是黑灰主色,而是蓝黑
UIManager.setLookAndFeel(UIManager.getCrossPlatformLookAndFeelClassName()); // 跨平台的Java界面风格,不太明白这种说法
UIManager.setLookAndFeel("com.sun.java.swing.plaf.windows.WindowsLookAndFeel") ; // windows风格 UIManager.setLookAndFeel("javax.swing.plaf.windows.WindowsLookAndFeel") ; // windows风格 UIManager.setLookAndFeel("javax.swing.plaf.metal.MetalLookAndFeel") ; // java风格 UIManager.setLookAndFeel("com.apple.mrj.swing.MacLookAndFeel"); // 现在在我的机器上没有特殊显示,
5 jsp与servlet传参乱码问题
6 查询数据库中的所有表明和指定表的所有列名的方法
查找所有用户表 select name from sysobjects where xtype='u'
查找指定表的所有列 select name from syscolumns where id = (select max(id) from sysobjects where xtype='u' and name='表名 ')
7判断两个日期的前后
8 myEclipse 复制工程时要注意
一定要修改下webroot(属性-MyEclipse-web选项)将原来路径改为现在工程的名字。