[root@localhost log]# rm -f /etc/localtime [root@localhost log]# cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime 再次查看时间正常 [root@localhost ~]# date ...
分类:
系统相关 时间:
2020-05-06 18:05:07
阅读次数:
316
近期在学习Linux C编程,在使用 localtime() 函数时遇到了比较奇怪的问题,我本想对比文件的最近修改时间和系统当前时间年份是否一致,按说定义两个struct tm*类型指针,再获取到两个struct tm *类型的指针变量后进行比较便可,但是无奈这两个结构体指向的tm_year成员值是 ...
分类:
编程语言 时间:
2020-05-03 18:33:56
阅读次数:
97
从Java日期时间API系列第一篇博客开始,利用业余时间对Java日期时间API源码进行了系统的、多次的阅读实践,包括Date、LocalDate、LocalDateTime、LocalTime、Instant、ZonedDateTime、YearMonth和Timestamp等源码,把和时间紧密相... ...
分类:
编程语言 时间:
2020-04-30 21:40:54
阅读次数:
86
nginxphp: image: richarvey/nginx-php-fpm:1.2.5 volumes: - /data/www/www.cnvp.com:/var/www/html - /etc/localtime:/etc/localtime:ro ports: - 9000:80 env ...
分类:
其他好文 时间:
2020-04-30 11:21:12
阅读次数:
65
Linux 修改配置文件来修改时区 1、修改/etc/sysconfig/clock ZONE=Asia/Shanghai 2、rm /etc/localtime 3、链接到上海时区文件 ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime ...
分类:
系统相关 时间:
2020-04-27 22:58:34
阅读次数:
129
#Mybatis 从3.4.5 开始,默认支持 JSR-310(日期和时间 API) 即java.time.* 下的时间类自动类型转换 本文使用的依赖 <dependency> <groupId>com.alibaba</groupId> <artifactId>druid-spring-boot- ...
分类:
其他好文 时间:
2020-04-26 17:13:46
阅读次数:
441
time模块时间模块里面有时间戳、格式化时间对象、时间字符串import time# 时间戳print(time.time()) # 1587642175.403718?# 格式化时间对象print(time.gmtime()) # 格林尼治时间对象print(time.localtime()) #... ...
分类:
其他好文 时间:
2020-04-23 21:23:21
阅读次数:
67
#!/bin/bash #设置时区并同步时间 ln -s /usr/share/zoneinfo/Asia/Shanghai /etc/localtime if ! crontab -l |grep ntpdate &>/dev/null ; then (echo "* 1 * * * ntpdat ...
分类:
系统相关 时间:
2020-04-22 16:28:30
阅读次数:
70
time.time() 返回当前时间的时间戳 time.localtime() 接收时间戳(1970纪元后经过的浮点秒数)并返回当地时间下的时间元组t time.strftime() 接收以时间元组,并返回以可读字符串表示的当地时间 time.strptime() 根据fmt的格式把一个时间字符串解 ...
分类:
其他好文 时间:
2020-04-22 00:09:38
阅读次数:
67
在使用django框架时,需要在settings中将时区设置成上海 TIME_ZONE = 'Asia/Shanghai' USE_TZ = True 手动方式: from django.utils import timezone # print(timezone.localtime(i.creat ...
分类:
编程语言 时间:
2020-04-17 23:45:21
阅读次数:
345