반응형
Notice
Recent Posts
Recent Comments
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | 6 | |
7 | 8 | 9 | 10 | 11 | 12 | 13 |
14 | 15 | 16 | 17 | 18 | 19 | 20 |
21 | 22 | 23 | 24 | 25 | 26 | 27 |
28 | 29 | 30 |
Tags
- spring boot
- redis
- jmeter
- Spring Open Feign
- RabbitMQ
- docker
- weblogic 10
- Docker Compose
- docker-compose
- Netty
- vue.js
- mybatis
- QueryDSL
- Hibernate
- argo cd
- spring cloud
- netflix oss
- cassandra
- Redis Sentinel
- JPA
- WebLogic
- ChannelPipeline
- docker compose mysql
- coalesce
- Airflow
- grafana
- Selenium
- MySQL
- KAFKA
- spring boot redis
Archives
- Today
- Total
IT.FARMER
python 기본 함수 time 본문
반응형
python 기본 함수 time
import time
# 내장 함수 time test
# Epoch 이후의 현재 시간을 초 단위로 반환합니다.
# 시스템 클럭이 제공하는 경우 1 초가있을 수 있습니다.
print(time.time())
# Epoch 이후 초를 현지 시간을 나타내는 시간 튜플로 변환하십시오.
# parameter : '초'가 전달되지 않으면 현재 시간을 변환하십시오.
print(time.localtime(time.time()))
# > time.struct_time(tm_year=2019, tm_mon=6, tm_mday=21, tm_hour=11, tm_min=31, tm_sec=20, tm_wday=4, tm_yday=172, tm_isdst=0)
# 시간 튜플을 문자열로 변환합니다 (예 : 'Sat Jun 06 16:26:11 1998'.
# 시간 튜플이 존재하지 않으면 localtime ()에 의해 반환 된 현재 시간 사용.
print(time.asctime(time.localtime(time.time())))
# > Fri Jun 21 11:31:20 2019
# 포멧지정에 따라 결과값 변경
# %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.
# %a Locale's abbreviated weekday name.
# %A Locale's full weekday name.
# %b Locale's abbreviated month name.
# %B Locale's full month name.
# %c Locale's appropriate date and time representation.
# %I Hour (12-hour clock) as a decimal number [01,12].
# %p Locale's equivalent of either AM or PM.
print(time.strftime('%Y-%m-%d', time.localtime(time.time())))
# > 2019-06-21
반응형
'python' 카테고리의 다른 글
selenuim 과 requests 비교 (0) | 2019.06.25 |
---|---|
selenium 웹크롤링 (0) | 2019.06.21 |
python datetime 사용방법 (0) | 2019.06.21 |
python random 함수 (0) | 2019.06.21 |
python centos 설치 (0) | 2019.06.21 |