Notice
Recent Posts
Recent Comments
Link
| 일 | 월 | 화 | 수 | 목 | 금 | 토 |
|---|---|---|---|---|---|---|
| 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 | 31 |
Tags
- Excel
- mssql
- PyQt5
- IOS
- port
- ASP
- 함수
- flutter
- node.js
- 라즈베리파이
- 맛집
- 유니티
- Unity
- swift
- pandas
- ubuntu
- Linux
- urllib
- GIT
- MySQL
- 날짜
- PyQt
- 리눅스
- MS-SQL
- PER
- python
- javascript
- tensorflow
- sqlite
- 다이어트
Archives
아미(아름다운미소)
[Python] 어제 날짜 구하기 본문
어제 날짜 구하기
#! /usr/bin/python2.7
# -*- coding: utf-8 -*-
#import datetime
#now = datetime.datetime.now()
#dt = now.strftime('%Y-%m-%d_%H:%M:%S')
import time
from datetime import date
today = date.today()
yesterday = date.fromtimestamp(time.time() - 60*60*24)
dty = yesterday.strftime('%Y-%m-%d'))
dty = yesterday.strftime('%Y%m%d')
dt = today.strftime('%Y-%m-%d')
dt = today.strftime('%Y%m%d')
print(" dty : "+ dty )
print(" dt : "+ dt )
'랭귀지 > python' 카테고리의 다른 글
| for와 함께 자주 사용하는 range함수 (0) | 2018.10.31 |
|---|---|
| python null 처리방법 (0) | 2018.10.29 |
| python py2exe를 이용한 파이썬 실행파일 만들기 (0) | 2018.10.25 |
| python shutil (0) | 2018.10.24 |
| python switch문 (0) | 2018.10.21 |
Comments