import java.sql.Timestamp;
import java.util.TimeZone;

/**
 * @Description:
 * @Author:chenyanbin
 * @Date:2021/4/8 下午3:24
 * @Versiion:1.0
 */
public class Demo02 {
    public static void main(String[] args) {
        long current=System.currentTimeMillis();//当前时间毫秒数
        long zero=current/(1000*3600*24)*(1000*3600*24)- TimeZone.getDefault().getRawOffset();//今天零点零分零秒的毫秒数
        long twelve=zero+24*60*60*1000-1;//今天23点59分59秒的毫秒数
        long yesterday=System.currentTimeMillis()-24*60*60*1000;//昨天的这一时间的毫秒数
        System.out.println(new Timestamp(current));//当前时间
        System.out.println(new Timestamp(yesterday));//昨天这一时间点
        System.out.println(new Timestamp(zero));//今天零点零分零秒
        System.out.println(new Timestamp(twelve));//今天23点59分59秒
    }
}

 

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-02-24
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2021-11-30
  • 2021-07-03
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案