0
0

More than 3 years have passed since last update.

Python3でマイクロ秒表示、日本時間で

Posted at
  • プログラム
# coding: utf-8

from datetime import datetime, timedelta, timezone
import time

for i in range(0, 7):
    date = datetime.now(timezone(timedelta(hours=+9), 'JST')).strftime("%Y-%m-%d %H:%M:%S.%f")
    print(date)
    time.sleep(0.17)
  • 実行結果
2020-08-13 04:03:58.874931
2020-08-13 04:03:59.045158
2020-08-13 04:03:59.215385
2020-08-13 04:03:59.385582
2020-08-13 04:03:59.555776
2020-08-13 04:03:59.725971
2020-08-13 04:03:59.896166
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