• JAVA 日期加减


    1. 用java.util.Calender来实现   

      Calendar calendar=Calendar.getInstance();   
        calendar.setTime(new Date()); 
        System.out.println(calendar.get(Calendar.DAY_OF_MONTH));//今天的日期 
        calendar.set(Calendar.DAY_OF_MONTH,calendar.get(Calendar.DAY_OF_MONTH)+1);//让日期加1  
        System.out.println(calendar.get(Calendar.DATE));//加1之后的日期Top 

      2.用java.text.SimpleDateFormat和java.util.Date来实现
               
        Date d=new Date();   
        SimpleDateFormat df=new SimpleDateFormat("yyyy-MM-dd");   
        System.out.println("今天的日期:"+df.format(d));   
        System.out.println("两天前的日期:" + df.format(new Date(d.getTime() - 2 * 24 * 60 * 60 * 1000)));  
        System.out.println("三天后的日期:" + df.format(new Date(d.getTime() + 3 * 24 * 60 * 60 * 1000)));

  • 相关阅读:
    SQL手工注入方法
    wireshark常见分析
    JOY靶机
    GoldenEye-v1靶机
    homeless靶机
    注入
    DC-9靶机
    你哈
    数据库常用数据类型
    数据表的基本操作
  • 原文地址:https://www.cnblogs.com/bilaisheng/p/4976137.html
Copyright © 2020-2023  润新知