import java . time . Instant ; import java . time . LocalDateTime ; import java . time . ZoneOffset ; import java . time . ZonedDateTime ; import java . time . format . DateTimeFormatter ; import java . util . Calendar ; import java . util . Date ; public class TimeDemo { public static void main ( String [ ] args ) { // 旧API System . out . println ( System . currentTimeMillis ( ) ) ; // 1594801771810 Date date = new Date ( ) ; System . out . println ( date . getTime ( ) ) ; // 1594802296250 Calendar calendar = Calendar . getInstance ( ) ; System . out . println ( calendar . getTimeInMillis ( ) ) ; // 1594802296258 // 新API Instant instant = Instant . now ( ) ; System . out . println ( instant . getEpochSecond ( ) ) ; // 1594802296 System . out . println ( instant . toEpochMilli ( ) ) ; // 1594802296321 LocalDateTime localDateTime = LocalDateTime . now ( ) ; System . out . println ( localDateTime . toEpochSecond ( ZoneOffset . of ( "+8" ) ) ) ; // 1594802868 ZonedDateTime zonedDateTime = ZonedDateTime . now ( ) ; System . out . println ( zonedDateTime . toEpochSecond ( ) ) ; // 1594803196 // 格式化 替换 SimpleDateFormat DateTimeFormatter formatter = DateTimeFormatter . ofPattern ( "yyyy-MM-dd HH:mm:ss" ) ; System . out . println ( formatter . format ( localDateTime ) ) ; // 2020-07-15 16:44:26 System . out . println ( LocalDateTime . parse ( "2020-07-15 16:43:47" , formatter ) ) ; // 2020-07-15T16:43:47
处理redis连接数超高 redis连接数过大

程序日志出现 ERR max number of clients reached 报错,发现redis连接数被占满。解决思路:1、进入redis服务,连接上去cd /data/tools/redis/bin && ./redis-cli -h 10.66.89.123 10.66.89.123:6379> info clients ERR max number of clie

python求一组数最小值运行 python求最小的100个素数

求100以内的素数素数的定义:1、素数又叫质数。2、素数指的是在正整数范围内,大于1并且只能被1和自身整除的数。3、最小的素数是2,大于2的素数都是奇数,2是素数中唯一的偶数。4、大于1的正整数中,不是素数就是合数代码:for i in range(2,100): j = 2 flag = 1 for j in range(2,i): if (i % j =