LoginSignup
0
0

More than 1 year has passed since last update.

#python でJST=日本時間=現地時刻を現在時刻を文字列で得る例

Last updated at Posted at 2019-04-02
  • python3
  • datetime オブジェクトを pytz で localize する
from pytz import timezone
from datetime import datetime

timezone('Asia/Tokyo').localize(datetime.now()).strftime('%Y-%m-%d %H:%M:%S %Z')

# '2019-04-02 19:50:55 JST'

Ref

Pythonの UTC ⇔ JST、文字列(UTC) ⇒ JST の変換とかのメモ - Qiita

Original by Github issue

チャットメンバー募集

何か質問、悩み事、相談などあればLINEオープンチャットもご利用ください。

Twitter

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0