标签:amp ace The clock 使用 with ros %s 开始
返回1970年1月1日 00:00:00开始按秒计算时间偏移量
time_stamp = time.time()
print(time_stamp,type(time_stamp))
>>>1569671240.0007255 <class 'float'>
format_time = time.strfttime("%Y-%m-%d %X")
print(format_time, type(format_time))
>>>2019-09-28 19:51:09 <class 'str'>
time.strfttime(参数)
%Y Year with century as a decimal number.
%m Month as a decimal number [01,12].
%d Day of the month as a decimal number [01,31].
%H Hour (24-hour clock) as a decimal number [00,23].
%M Minute as a decimal number [00,59].
%S Second as a decimal number [00,61].
%z Time zone offset from UTC.
year=1949,
month=10,
day=1,
hour=10,
minute=1,
second=0,
microsecond=0
now = datetime.datetime.now()
print(now)
print(datetime.datetime.now() + datetime.timedelta(3))
默认更改天,可使用参数进行更改
print(now.replace(year=1949, month=10, day=1, hour=10, minute=1, second=0, microsecond=0))
标签:amp ace The clock 使用 with ros %s 开始
原文地址:https://www.cnblogs.com/agsol/p/11604975.html