파이썬[Python]: datetime - timetuple 메서드

datetime 모듈 - date 클래스 - timetuple 메서드(method)


/// 설명

time.localtime() 에서 반환되는 것과 같은 구조를 반환합니다.

※ 형식
date.timetuple()

/// 예제

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
import time
import datetime
 
test_calendar = datetime.date.fromisocalendar(2021472)
print(test_calendar)  # 2021-11-23
 
test_timetuple = test_calendar.timetuple()
print(test_timetuple)  # 2022-11-23
 
# related to this method ------------------------------
test_time = time.time()
# epoch: the time starts + 9 (Korea Standard Time, KST = UTC + 9)
print(time.localtime(test_time))
# time.struct_time(tm_year=1970, tm_mon=1, tm_mday=1, tm_hour=0, tm_min=0, tm_sec=0, tm_wday=3, tm_yday=1, tm_isdst=0)
 
cs

* 실행환경: Microsoft Windows 10 Homes
* 인터프리터: 파이썬(Python 3.9)


– 당신을 응원합니다. –

댓글

이 블로그의 인기 게시물

파이썬[Python]: 내장함수 - from_bytes 메서드

파이썬[Python]: 내장함수 - __len__ 메서드

파이썬[Python]: kivy - 한글 사용

C 언어: sin 함수, cos 함수, tan 함수

파이썬[Python]: 내장함수 - bit_length 메서드