Java入门:Date类型与String类型的转化

上一篇 / 下一篇  2008-04-29 14:37:00 / 个人分类:开发人生

import java.util.*;

public class MyDate {
public static Date dateFromString(String str) {
        if (str == null) {
            return null;
        }
        if (str.equalsIgnoreCase("")) {        
            return null;
        }
        java.util.Date ret = null;

        try {
            java.sql.Date date = java.sql.Date.valueOf(str);
           
            ret = new Date(date.getTime());
        } catch (Exception e) {}
        return ret;    
    }

    public static String dateToString(Date date) {
        String ret = "";

        if (date != null) {
            java.sql.Date sqldate = new java.sql.Date(date.getTime());

            ret = sqldate.toString();
        }
               
        return ret;
        
    }




TAG: Java java JAVA

headhunter 引用 删除 headhunter   /   2008-01-04 19:04:00

i am a headhunter and now i am searching an IT operation Mgr who should has experience in retail industry or supermarket, this position will cover all china, another position is for a senior programmer who should be familiar with java and oracle, and should has experience in insurance corp, third position is logistic Svr who shoud be female and Hukou is in Sahnghai.these positions all require fluent written and spoken English.and all for  corps of fortune 500 and will base in HQ(shanghai), if you are interested pls contact 13701017004,or


freeshi2007@hotmail.com


thanks yours sincerely vincent

 

评分:0

我来说两句

显示全部

:loveliness: :handshake :victory: :funk: :time: :kiss: :call: :hug: :lol :'( :Q :L ;P :$ :P :o :@ :D :( :)

日历

« 2008-07-06  
  12345
6789101112
13141516171819
20212223242526
2728293031  

数据统计

  • 访问量: 3155
  • 日志数: 126
  • 建立时间: 2007-03-21
  • 更新时间: 2008-04-07

RSS订阅

Open Toolbar