正文

时间  比较小程序2006-04-08 18:03:00

【评论】 【打印】 【字体: 】 本文链接:http://blog.pfan.cn/sword2008/12113.html

分享到:

import java.text.SimpleDateFormat;
import java.util.Date;


public class Test
{
public static SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
private static void compare_Date(Date EffectiveStartDate){
Date dtCurrent=new Date();
       
String EffectiveStart_Date = sdf.format(EffectiveStartDate);
        String dtCurrent_Date = sdf.format(dtCurrent);
       
    if(EffectiveStart_Date.compareTo(dtCurrent_Date) >= 0)
    {
       System.out.println("effective date >= current date");
    }
    else
    {
       System.out.println("effective date < current date");
    }
}

    public static void main(String[] args) {
        
     Date EffectiveStartDate = new Date();
         compare_Date(EffectiveStartDate);
    }
}

 

阅读(4130) | 评论(0)


版权声明:编程爱好者网站为此博客服务提供商,如本文牵涉到版权问题,编程爱好者网站不承担相关责任,如有版权问题请直接与本文作者联系解决。谢谢!

评论

暂无评论
您需要登录后才能评论,请 登录 或者 注册